diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp index 47eafb19..ffb9bf5c 100644 --- a/include/reporters/catch_reporter_teamcity.hpp +++ b/include/reporters/catch_reporter_teamcity.hpp @@ -68,9 +68,11 @@ namespace Catch { std::ostringstream msg; if( !m_headerPrintedForThisSection ) - printTestCaseAndSectionHeader( msg ); + printSectionHeader( msg ); m_headerPrintedForThisSection = true; + msg << result.getSourceInfo() << "\n"; + switch( result.getResultType() ) { case ResultWas::ExpressionFailed: msg << "expression failed"; @@ -117,8 +119,6 @@ namespace Catch { "with expansion:\n" << " " << result.getExpandedExpression() << "\n"; } - msg << "\n" << result.getSourceInfo() << "\n"; - msg << "---------------------------------------"; stream << "##teamcity[testFailed" << " name='" << escape( currentTestCaseInfo->name )<< "'" @@ -159,32 +159,27 @@ namespace Catch { // } private: - void printTestCaseAndSectionHeader( std::ostream& os ) { + void printSectionHeader( std::ostream& os ) { assert( !m_sectionStack.empty() ); - printOpenHeader( os, currentTestCaseInfo->name ); - + if( m_sectionStack.size() > 1 ) { + os << getLineOfChars<'-'>() << "\n"; + std::vector::const_iterator it = m_sectionStack.begin()+1, // Skip first section (test case) itEnd = m_sectionStack.end(); for( ; it != itEnd; ++it ) - printHeaderString( os, it->name, 2 ); + printHeaderString( os, it->name ); + os << getLineOfChars<'-'>() << "\n"; } SourceLineInfo lineInfo = m_sectionStack.front().lineInfo; - if( !lineInfo.empty() ){ - os << getLineOfChars<'-'>() << "\n"; + if( !lineInfo.empty() ) os << lineInfo << "\n"; - } os << getLineOfChars<'.'>() << "\n\n"; } - void printOpenHeader( std::ostream& os, std::string const& _name ) { - os << getLineOfChars<'-'>() << "\n"; - printHeaderString( os, _name ); - } - // if string has a : in first line will set indent to follow it on // subsequent lines void printHeaderString( std::ostream& os, std::string const& _string, std::size_t indent = 0 ) {