I'd like to choose which test to run using the TextUi::TestRunner class, much like the MFC TestRunner (either command line option or TUI...)... selecting which test to run isn't hard... but I'm having trouble getting CppUnit to run a specific named test.
I tried using the macro CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(), adding the classes to a TestSuite using the TestFactoryRegistry, but the only named test I could run was "All Tests", which is the default. For example (assuming my test class is CTestClass):
I'd like to choose which test to run using the TextUi::TestRunner class, much like the MFC TestRunner (either command line option or TUI...)... selecting which test to run isn't hard... but I'm having trouble getting CppUnit to run a specific named test.
I tried using the macro CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(), adding the classes to a TestSuite using the TestFactoryRegistry, but the only named test I could run was "All Tests", which is the default. For example (assuming my test class is CTestClass):
<snip>
using namespace CppUnit;
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION("TestClass,"CTestClass");
...
TestFactoryRegistry ®istry = TestFactoryRegistry.getRegistry();
registry.registerFactory(&TestFactoryRegistry::getRegistry("CTestClass"));
...
runner.run("CTestClass");
</snip>
No matter what I try, runner.run() returns something to the effect that the class cannot be found. The line "runner.run("All Tests") does work.
Any ideas?
thanks
mike
Does anyone have a code snippet that accomplishes this?
thanks!
mike