Added className to TestCaseInfo

className is passed through from class based test methods and held in the TestCaseInfo.
For free-function based test cases it is set to "global".

The JUnit reporter uses the className value to populate he class attribute.
This commit is contained in:
Phil Nash
2012-11-04 21:11:59 +00:00
parent 81cb69ef18
commit 78fba28c4b
7 changed files with 64 additions and 31 deletions

View File

@@ -26,7 +26,10 @@ namespace Catch {
struct TestCaseStats {
TestCaseStats( const std::string& name = std::string() ) :m_name( name ){}
TestCaseStats( const std::string& className, const std::string& name )
: m_className( className ),
m_name( name )
{}
double m_timeInSeconds;
std::string m_status;
@@ -94,7 +97,7 @@ namespace Catch {
virtual void EndSection( const std::string&, const Counts& ) {}
virtual void StartTestCase( const Catch::TestCaseInfo& testInfo ) {
m_currentStats->m_testCaseStats.push_back( TestCaseStats( testInfo.getName() ) );
m_currentStats->m_testCaseStats.push_back( TestCaseStats( testInfo.getClassName(), testInfo.getName() ) );
}
virtual void Result( const Catch::AssertionResult& assertionResult ) {