How to check the test result in the tearDown()
"Eugene Zozulya" <eugene.zozulya-/azQCtZra8xWk0Htik3J/[email protected]> Fri, 10 Jan 2003 10:01:45 -0500
| Newsgroups | gmane.comp.lib.cppunit.devel |
|---|---|
| Message-ID | <[email protected]> |
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 = 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=0;
m_OutFile << " test " << ++l_count
<< " - " << m_pResult->wasSuccessful()
<< " - " << m_pResult->runTests()
<< " - " << m_pResult->testErrors()
<< " - " << m_pResult->testFailures()
<< " - " << m_pResult->testFailuresTotal()
<< endl;
}
Any suggestions would be appreciated.
Thanks,
Eugene
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com