[Cppunit-devel] How to check the test result in the tearDown()
Brought to you by:
blep
From: Eugene Z. <eug...@th...> - 2003-01-10 15:01:16
|
Hi all, Is any way to know the test result in the tearDown() except using the = flags? The following doesn't work (might be stupid, but I've tried...): // cppunit-1.9.10 class MyTest: public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( MyTest ); CPPUNIT_TEST( MyTestCase ); CPPUNIT_TEST_SUITE_END(); public: virtual void setUp(); virtual void tearDown(); void MyTestCase(); private: fstream m_OutFile; CPPUNIT_NS::TestResultCollector *m_pResult; } CategMapTest::MyTest() { m_OutFile.open("MyTest.out", ios::out | ios::app); m_pResult =3D new CPPUNIT_NS::TestResultCollector(); CPPUNIT_NS::TestResult().addListener( m_pResult ); } CategMapTest::~MyTest() { m_OutFile.close(); delete m_pResult; } void MyTest::setUp() { } void MyTest::MyTestCase() { CPPUNIT_ASSERT(false); } void MyTest::tearDown() { static int l_count=3D0; m_OutFile << " test " << ++l_count=20 << " - " << m_pResult->wasSuccessful()=20 << " - " << m_pResult->runTests() << " - " << m_pResult->testErrors() << " - " << m_pResult->testFailures() << " - " << m_pResult->testFailuresTotal() << endl; } Any suggestions would be appreciated. Thanks, Eugene=20 |