Re: [Cppunit-devel] Running subset of CPPUnit tests in non-interactive mode
Brought to you by:
blep
|
From: <vri...@us...> - 2005-12-24 15:02:25
|
> My scenario is slightly different. I have one test-suite and two =
testcases within that suite. Here is how my class and registration =
looks like:
>=20
> class RPTest : public CPPUNIT_NS::TestFixture{
> CPPUNIT_TEST_SUITE( RPTest );
> CPPUNIT_TEST( testConnection );
> CPPUNIT_TEST( testSession );=20
> CPPUNIT_TEST_SUITE_END();
> public:
> ....
> };
>=20
> CPPUNIT_TEST_SUITE_REGISTRATION( RPTest );
>=20
> I want to print names of testcases within the test suite like
> testConnection
> testSession
>=20
> How can I do this?
You have to go on step deeper !
TestFactoryRegistry::makeTest() returns a tree of Test.
The childs are the test classes.
The childs of the childs are the test methods.
So if you try :
CPPUNIT_NS::Test *childTest =3D suite->getChildTestAt( 0 );
CPPUNIT_NS::Test *methodTest =3D childTest->getChildTestAt( 0 );
cout << "MethodTestName is: " << methodTest->getName() << endl;
You will get : "RPTest::testConnection"
It should be good !
> Anyone tried to run subset of testcases within a test-suite in =
non-interactive mode? Any suggestions?
Try this :
CPPUNIT_NS::Test* testToRun =3D =
suite->findTest("RPTest::testConnection");
...
Vincent.
|