diff options
| author | Martin Hořeňovský | 2017-06-06 16:52:02 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2017-06-06 16:52:02 +0200 |
| commit | ebb3371cbfef631330a0bd18ed99c2dc38009906 (patch) | |
| tree | d9e61ba4bd54a92e654b33be725c0d3f0aec443f /include | |
| parent | b6d9976fbb3f67f5a6b3b48dec9de3f1c2b76a3a (diff) | |
| parent | 69ff7fcf4243e2b874dda9a8ab34993c31c879f1 (diff) | |
| download | catch3-ebb3371cbfef631330a0bd18ed99c2dc38009906.tar.gz | |
Merge remote-tracking branch 'tsondergaard/improve-junit-xml-for-jenkins' into dev-modernize
Diffstat (limited to 'include')
| -rw-r--r-- | include/reporters/catch_reporter_junit.hpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/reporters/catch_reporter_junit.hpp b/include/reporters/catch_reporter_junit.hpp index 874b0f97..cebdf3c7 100644 --- a/include/reporters/catch_reporter_junit.hpp +++ b/include/reporters/catch_reporter_junit.hpp @@ -124,6 +124,13 @@ namespace Catch { xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite.str() ), false ); } + static std::string fileNameTag( const std::set<std::string> &tags ) { + std::set<std::string>::const_iterator it = tags.lower_bound("#"); + if( it != tags.end() && !it->empty() && it->front() == '#' ) + return it->substr(1); + return std::string(); + } + void writeTestCase( TestCaseNode const& testCaseNode ) { TestCaseStats const& stats = testCaseNode.value; @@ -135,9 +142,14 @@ namespace Catch { std::string className = stats.testInfo.className; if( className.empty() ) { - if( rootSection.childSections.empty() ) + className = fileNameTag(stats.testInfo.tags); + if ( className.empty() ) className = "global"; } + + if ( !m_config->name().empty() ) + className = m_config->name() + "." + className; + writeSection( className, "", rootSection ); } |