No logging of the exception throw
Brought to you by:
hartwork
When an exception is thrown within TEST_ASSERT then the whole function is reported as 0% successful. However, there is no information about what is the reason of 0% result and at what line the exception is thrown which makes fixing the problem harder.
I propose to change TEST_ASSERT to add information to the report that unexpected exception is thrown and log also the line and file where the TEST_ASSERT is invoked.
Good catch . The fix to this will be part of a larger fix to exception handling, which we only do minimally at this point.
Has anything been done on this bug? I don't mind if there is no rigorous exception handling, but printing out e.what() would be very beneficial. It is very confusing for developers when a test fails due to an exception, and there is no output explaining this from CppTest.
I might find time to review patches, but that's all, I'm afraid.
I can suggest the following fix, Although it may not work for more sophisticated outputs (html etc.)
Modify lines 180 of src/suite.cpp onwards as follows:
Text output:
SolutionVariableTest: 3/4
Error: An exception was thrown during test 'testSolMap()'
Details: You have already added a SolutionVariable of corresponding VariableNames type to SolutionMap
SolutionVariableTest: 4/4
SolutionVariableTest: 4/4, 75% correct in 0.000466 seconds
I understand that output should be done via _suite._output. Perhaps class Output should have a new public function exception(testName, msg).
Last edit: Philip Wardlaw 2014-05-01