How do I change the output of cppunit from dots, indicating how many tests are done to the actual names of the tests, or maybe just at least the string which was given to the test-caller, as counting the dots and guessing which test-function it represents is quite unproductive, in case of an Segmentation Fault which actually kills the whole program. I did just find reference for changing the error-output in case of a failed assert, but nothing on the general output.
The suite function of my Testclass:
static CppUnit::Test *suite() {
CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite( "Map Parser" );
//string to state
suiteOfTests->addTest( new CppUnit::TestCaller<Parser_test>("string to state I",&Parser_test::test_string_to_state_I));
....
return suiteOfTests;
}
Main.cpp
CppUnit::TextUi::TestRunner runner;
runner.addTest( Parser_test::suite() );
runner.run();
I would love to have some output like this:
string to state I : OK
string to state II : OK
...
as then I am able to determine when the program crashed due to a non-catchable exception, like a SegFault.
But at the moment my ouptut looks like this:
...........
Segmentation fault
A BriefTestProgressListener does the job:
CppUnit::TestResult controller;
CppUnit::TestResultCollector result;
controller.addListener( &result );
CppUnit::BriefTestProgressListener progressListener;
controller.addListener( &progressListener );
CppUnit::TestRunner runner;
runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() );
runner.run( controller );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With