Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2
diff options
context:
space:
mode:
authorMartin Hořeňovský2021-09-06 22:59:40 +0200
committerMartin Hořeňovský2021-09-07 20:00:22 +0200
commite5938007f7dab5c9886ca561d09106ee4d7f2301 (patch)
tree84d3c00fe319f43248bcd751362a1353057eed36 /src/catch2
parentab3fe0053d41ea80be5b0d11e7e9c49852810021 (diff)
downloadcatch3-e5938007f7dab5c9886ca561d09106ee4d7f2301.tar.gz
Completely remove the testGroup events
This was done because they were 1:1 mapping to testRun events, and I could not think of a reasonable way to make them their own thing.
Diffstat (limited to 'src/catch2')
-rw-r--r--src/catch2/catch_session.cpp2
-rw-r--r--src/catch2/interfaces/catch_interfaces_reporter.cpp28
-rw-r--r--src/catch2/interfaces/catch_interfaces_reporter.hpp22
-rw-r--r--src/catch2/internal/catch_run_context.cpp9
-rw-r--r--src/catch2/internal/catch_run_context.hpp3
-rw-r--r--src/catch2/reporters/catch_reporter_combined_tu.cpp2
-rw-r--r--src/catch2/reporters/catch_reporter_console.cpp21
-rw-r--r--src/catch2/reporters/catch_reporter_console.hpp2
-rw-r--r--src/catch2/reporters/catch_reporter_cumulative_base.cpp8
-rw-r--r--src/catch2/reporters/catch_reporter_cumulative_base.hpp6
-rw-r--r--src/catch2/reporters/catch_reporter_event_listener.hpp2
-rw-r--r--src/catch2/reporters/catch_reporter_junit.cpp23
-rw-r--r--src/catch2/reporters/catch_reporter_junit.hpp6
-rw-r--r--src/catch2/reporters/catch_reporter_listening.cpp15
-rw-r--r--src/catch2/reporters/catch_reporter_listening.hpp2
-rw-r--r--src/catch2/reporters/catch_reporter_sonarqube.cpp15
-rw-r--r--src/catch2/reporters/catch_reporter_sonarqube.hpp10
-rw-r--r--src/catch2/reporters/catch_reporter_streaming_base.cpp10
-rw-r--r--src/catch2/reporters/catch_reporter_streaming_base.hpp4
-rw-r--r--src/catch2/reporters/catch_reporter_teamcity.cpp12
-rw-r--r--src/catch2/reporters/catch_reporter_teamcity.hpp4
-rw-r--r--src/catch2/reporters/catch_reporter_xml.cpp22
-rw-r--r--src/catch2/reporters/catch_reporter_xml.hpp4
23 files changed, 37 insertions, 195 deletions
diff --git a/src/catch2/catch_session.cpp b/src/catch2/catch_session.cpp
index 6ce21803..9738cbb4 100644
--- a/src/catch2/catch_session.cpp
+++ b/src/catch2/catch_session.cpp
@@ -77,7 +77,6 @@ namespace Catch {
Totals execute() {
auto const& invalidArgs = m_config->testSpec().getInvalidArgs();
Totals totals;
- m_context.testGroupStarting(m_config->name(), 1, 1);
for (auto const& testCase : m_tests) {
if (!m_context.aborting())
totals += m_context.runTest(*testCase);
@@ -97,7 +96,6 @@ namespace Catch {
m_reporter->reportInvalidArguments(invalidArg);
}
- m_context.testGroupEnded(m_config->name(), totals, 1, 1);
return totals;
}
diff --git a/src/catch2/interfaces/catch_interfaces_reporter.cpp b/src/catch2/interfaces/catch_interfaces_reporter.cpp
index 19416130..81892e82 100644
--- a/src/catch2/interfaces/catch_interfaces_reporter.cpp
+++ b/src/catch2/interfaces/catch_interfaces_reporter.cpp
@@ -32,17 +32,9 @@ namespace Catch {
TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {}
- GroupInfo::GroupInfo( std::string const& _name,
- std::size_t _groupIndex,
- std::size_t _groupsCount )
- : name( _name ),
- groupIndex( _groupIndex ),
- groupsCounts( _groupsCount )
- {}
-
- AssertionStats::AssertionStats( AssertionResult const& _assertionResult,
- std::vector<MessageInfo> const& _infoMessages,
- Totals const& _totals )
+ AssertionStats::AssertionStats( AssertionResult const& _assertionResult,
+ std::vector<MessageInfo> const& _infoMessages,
+ Totals const& _totals )
: assertionResult( _assertionResult ),
infoMessages( _infoMessages ),
totals( _totals )
@@ -84,20 +76,6 @@ namespace Catch {
{}
- TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo,
- Totals const& _totals,
- bool _aborting )
- : groupInfo( _groupInfo ),
- totals( _totals ),
- aborting( _aborting )
- {}
-
- TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo )
- : groupInfo( _groupInfo ),
- aborting( false )
- {}
-
-
TestRunStats::TestRunStats( TestRunInfo const& _runInfo,
Totals const& _totals,
bool _aborting )
diff --git a/src/catch2/interfaces/catch_interfaces_reporter.hpp b/src/catch2/interfaces/catch_interfaces_reporter.hpp
index f1d93f7e..2e64d73e 100644
--- a/src/catch2/interfaces/catch_interfaces_reporter.hpp
+++ b/src/catch2/interfaces/catch_interfaces_reporter.hpp
@@ -48,15 +48,6 @@ namespace Catch {
TestRunInfo( std::string const& _name );
std::string name;
};
- struct GroupInfo {
- GroupInfo( std::string const& _name,
- std::size_t _groupIndex,
- std::size_t _groupsCount );
-
- std::string name;
- std::size_t groupIndex;
- std::size_t groupsCounts;
- };
struct AssertionStats {
AssertionStats( AssertionResult const& _assertionResult,
@@ -99,17 +90,6 @@ namespace Catch {
bool aborting;
};
- struct TestGroupStats {
- TestGroupStats( GroupInfo const& _groupInfo,
- Totals const& _totals,
- bool _aborting );
- TestGroupStats( GroupInfo const& _groupInfo );
-
- GroupInfo groupInfo;
- Totals totals;
- bool aborting;
- };
-
struct TestRunStats {
TestRunStats( TestRunInfo const& _runInfo,
Totals const& _totals,
@@ -196,7 +176,6 @@ namespace Catch {
virtual void reportInvalidArguments(std::string const&) {}
virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0;
- virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0;
virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0;
virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0;
@@ -213,7 +192,6 @@ namespace Catch {
virtual void sectionEnded( SectionStats const& sectionStats ) = 0;
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0;
- virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0;
virtual void testRunEnded( TestRunStats const& testRunStats ) = 0;
virtual void skipTest( TestCaseInfo const& testInfo ) = 0;
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index b3fb8b11..222ee932 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -175,14 +175,6 @@ namespace Catch {
m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting()));
}
- void RunContext::testGroupStarting(std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount) {
- m_reporter->testGroupStarting(GroupInfo(testSpec, groupIndex, groupsCount));
- }
-
- void RunContext::testGroupEnded(std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount) {
- m_reporter->testGroupEnded(TestGroupStats(GroupInfo(testSpec, groupIndex, groupsCount), totals, aborting()));
- }
-
Totals RunContext::runTest(TestCaseHandle const& testCase) {
Totals prevTotals = m_totals;
@@ -389,7 +381,6 @@ namespace Catch {
std::string(),
false));
m_totals.testCases.failed++;
- testGroupEnded(std::string(), m_totals, 1, 1);
m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false));
}
diff --git a/src/catch2/internal/catch_run_context.hpp b/src/catch2/internal/catch_run_context.hpp
index 0a20866e..7c315e9a 100644
--- a/src/catch2/internal/catch_run_context.hpp
+++ b/src/catch2/internal/catch_run_context.hpp
@@ -40,9 +40,6 @@ namespace Catch {
~RunContext() override;
- void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount );
- void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount );
-
Totals runTest(TestCaseHandle const& testCase);
public: // IResultCapture
diff --git a/src/catch2/reporters/catch_reporter_combined_tu.cpp b/src/catch2/reporters/catch_reporter_combined_tu.cpp
index 42974249..5a75abd2 100644
--- a/src/catch2/reporters/catch_reporter_combined_tu.cpp
+++ b/src/catch2/reporters/catch_reporter_combined_tu.cpp
@@ -231,12 +231,10 @@ namespace Catch {
void EventListenerBase::listTags( std::vector<TagInfo> const& ) {}
void EventListenerBase::noMatchingTestCases( std::string const& ) {}
void EventListenerBase::testRunStarting( TestRunInfo const& ) {}
- void EventListenerBase::testGroupStarting( GroupInfo const& ) {}
void EventListenerBase::testCaseStarting( TestCaseInfo const& ) {}
void EventListenerBase::sectionStarting( SectionInfo const& ) {}
void EventListenerBase::sectionEnded( SectionStats const& ) {}
void EventListenerBase::testCaseEnded( TestCaseStats const& ) {}
- void EventListenerBase::testGroupEnded( TestGroupStats const& ) {}
void EventListenerBase::testRunEnded( TestRunStats const& ) {}
void EventListenerBase::skipTest( TestCaseInfo const& ) {}
} // namespace Catch
diff --git a/src/catch2/reporters/catch_reporter_console.cpp b/src/catch2/reporters/catch_reporter_console.cpp
index b306800f..0ad31360 100644
--- a/src/catch2/reporters/catch_reporter_console.cpp
+++ b/src/catch2/reporters/catch_reporter_console.cpp
@@ -487,15 +487,6 @@ void ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) {
StreamingReporterBase::testCaseEnded(_testCaseStats);
m_headerPrinted = false;
}
-void ConsoleReporter::testGroupEnded(TestGroupStats const& _testGroupStats) {
- if (currentGroupInfo.used) {
- printSummaryDivider();
- stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n";
- printTotals(_testGroupStats.totals);
- stream << "\n\n" << std::flush;
- }
- StreamingReporterBase::testGroupEnded(_testGroupStats);
-}
void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) {
printTotalsDivider(_testRunStats.totals);
printTotals(_testRunStats.totals);
@@ -515,11 +506,9 @@ void ConsoleReporter::lazyPrint() {
void ConsoleReporter::lazyPrintWithoutClosingBenchmarkTable() {
- if (!currentTestRunInfo.used)
+ if ( !currentTestRunInfo.used ) {
lazyPrintRunInfo();
- if (!currentGroupInfo.used)
- lazyPrintGroupInfo();
-
+ }
if (!m_headerPrinted) {
printTestCaseAndSectionHeader();
m_headerPrinted = true;
@@ -537,12 +526,6 @@ void ConsoleReporter::lazyPrintRunInfo() {
currentTestRunInfo.used = true;
}
-void ConsoleReporter::lazyPrintGroupInfo() {
- if (!currentGroupInfo->name.empty() && currentGroupInfo->groupsCounts > 1) {
- printClosedHeader("Group: " + currentGroupInfo->name);
- currentGroupInfo.used = true;
- }
-}
void ConsoleReporter::printTestCaseAndSectionHeader() {
assert(!m_sectionStack.empty());
printOpenHeader(currentTestCaseInfo->name);
diff --git a/src/catch2/reporters/catch_reporter_console.hpp b/src/catch2/reporters/catch_reporter_console.hpp
index 0cf8589c..d8007a31 100644
--- a/src/catch2/reporters/catch_reporter_console.hpp
+++ b/src/catch2/reporters/catch_reporter_console.hpp
@@ -40,7 +40,6 @@ namespace Catch {
void benchmarkFailed( StringRef error ) override;
void testCaseEnded(TestCaseStats const& _testCaseStats) override;
- void testGroupEnded(TestGroupStats const& _testGroupStats) override;
void testRunEnded(TestRunStats const& _testRunStats) override;
void testRunStarting(TestRunInfo const& _testRunInfo) override;
private:
@@ -49,7 +48,6 @@ namespace Catch {
void lazyPrintWithoutClosingBenchmarkTable();
void lazyPrintRunInfo();
- void lazyPrintGroupInfo();
void printTestCaseAndSectionHeader();
void printClosedHeader(std::string const& _name);
diff --git a/src/catch2/reporters/catch_reporter_cumulative_base.cpp b/src/catch2/reporters/catch_reporter_cumulative_base.cpp
index a76a85ea..e0007030 100644
--- a/src/catch2/reporters/catch_reporter_cumulative_base.cpp
+++ b/src/catch2/reporters/catch_reporter_cumulative_base.cpp
@@ -98,16 +98,10 @@ namespace Catch {
m_deepestSection->stdErr = testCaseStats.stdErr;
}
- void CumulativeReporterBase::testGroupEnded(
- TestGroupStats const& testGroupStats ) {
- auto node = Detail::make_unique<TestGroupNode>( testGroupStats );
- node->children.swap( m_testCases );
- m_testGroups.push_back( CATCH_MOVE(node) );
- }
void CumulativeReporterBase::testRunEnded( TestRunStats const& testRunStats ) {
m_testRuns.emplace_back( testRunStats );
- m_testRuns.back().children.swap( m_testGroups );
+ m_testRuns.back().children.swap( m_testCases );
testRunEndedCumulative();
}
diff --git a/src/catch2/reporters/catch_reporter_cumulative_base.hpp b/src/catch2/reporters/catch_reporter_cumulative_base.hpp
index 2820e9f6..34e5e794 100644
--- a/src/catch2/reporters/catch_reporter_cumulative_base.hpp
+++ b/src/catch2/reporters/catch_reporter_cumulative_base.hpp
@@ -42,8 +42,7 @@ namespace Catch {
using TestCaseNode = Node<TestCaseStats, SectionNode>;
- using TestGroupNode = Node<TestGroupStats, TestCaseNode>;
- using TestRunNode = Node<TestRunStats, TestGroupNode>;
+ using TestRunNode = Node<TestRunStats, TestCaseNode>;
CumulativeReporterBase( ReporterConfig const& _config ):
IStreamingReporter( _config.fullConfig() ),
@@ -51,7 +50,6 @@ namespace Catch {
~CumulativeReporterBase() override;
void testRunStarting( TestRunInfo const& ) override {}
- void testGroupStarting( GroupInfo const& ) override {}
void testCaseStarting( TestCaseInfo const& ) override {}
@@ -62,7 +60,6 @@ namespace Catch {
bool assertionEnded( AssertionStats const& assertionStats ) override;
void sectionEnded( SectionStats const& sectionStats ) override;
void testCaseEnded( TestCaseStats const& testCaseStats ) override;
- void testGroupEnded( TestGroupStats const& testGroupStats ) override;
void testRunEnded( TestRunStats const& testRunStats ) override;
//! Customization point: called after last test finishes (testRunEnded has been handled)
virtual void testRunEndedCumulative() = 0;
@@ -78,7 +75,6 @@ namespace Catch {
// Note: We rely on pointer identity being stable, which is why
// which is why we store around pointers rather than values.
std::vector<Detail::unique_ptr<TestCaseNode>> m_testCases;
- std::vector<Detail::unique_ptr<TestGroupNode>> m_testGroups;
std::vector<TestRunNode> m_testRuns;
diff --git a/src/catch2/reporters/catch_reporter_event_listener.hpp b/src/catch2/reporters/catch_reporter_event_listener.hpp
index ee65eebd..034c6f3c 100644
--- a/src/catch2/reporters/catch_reporter_event_listener.hpp
+++ b/src/catch2/reporters/catch_reporter_event_listener.hpp
@@ -34,12 +34,10 @@ namespace Catch {
void noMatchingTestCases( std::string const& spec ) override;
void testRunStarting( TestRunInfo const& testRunInfo ) override;
- void testGroupStarting( GroupInfo const& groupInfo ) override;
void testCaseStarting( TestCaseInfo const& testInfo ) override;
void sectionStarting( SectionInfo const& sectionInfo ) override;
void sectionEnded( SectionStats const& sectionStats ) override;
void testCaseEnded( TestCaseStats const& testCaseStats ) override;
- void testGroupEnded( TestGroupStats const& testGroupStats ) override;
void testRunEnded( TestRunStats const& testRunStats ) override;
void skipTest( TestCaseInfo const& testInfo ) override;
};
diff --git a/src/catch2/reporters/catch_reporter_junit.cpp b/src/catch2/reporters/catch_reporter_junit.cpp
index 7570d9ea..ba11c55a 100644
--- a/src/catch2/reporters/catch_reporter_junit.cpp
+++ b/src/catch2/reporters/catch_reporter_junit.cpp
@@ -75,14 +75,10 @@ namespace Catch {
void JunitReporter::testRunStarting( TestRunInfo const& runInfo ) {
CumulativeReporterBase::testRunStarting( runInfo );
xml.startElement( "testsuites" );
- }
-
- void JunitReporter::testGroupStarting( GroupInfo const& groupInfo ) {
suiteTimer.start();
stdOutForSuite.clear();
stdErrForSuite.clear();
unexpectedExceptions = 0;
- CumulativeReporterBase::testGroupStarting( groupInfo );
}
void JunitReporter::testCaseStarting( TestCaseInfo const& testCaseInfo ) {
@@ -101,21 +97,20 @@ namespace Catch {
CumulativeReporterBase::testCaseEnded( testCaseStats );
}
- void JunitReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {
- double suiteTime = suiteTimer.getElapsedSeconds();
- CumulativeReporterBase::testGroupEnded( testGroupStats );
- writeGroup( *m_testGroups.back(), suiteTime );
- }
-
void JunitReporter::testRunEndedCumulative() {
+ const auto suiteTime = suiteTimer.getElapsedSeconds();
+ // HACK: There can only be one testRunNode? This needs to be
+ // refactored after the group nodes are excised.
+ assert(m_testRuns.size() == 1);
+ writeRun( m_testRuns.back(), suiteTime );
xml.endElement();
}
- void JunitReporter::writeGroup( TestGroupNode const& groupNode, double suiteTime ) {
+ void JunitReporter::writeRun( TestRunNode const& testRunNode, double suiteTime ) {
XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" );
- TestGroupStats const& stats = groupNode.value;
- xml.writeAttribute( "name"_sr, stats.groupInfo.name );
+ TestRunStats const& stats = testRunNode.value;
+ xml.writeAttribute( "name"_sr, stats.runInfo.name );
xml.writeAttribute( "errors"_sr, unexpectedExceptions );
xml.writeAttribute( "failures"_sr, stats.totals.assertions.failed-unexpectedExceptions );
xml.writeAttribute( "tests"_sr, stats.totals.assertions.total() );
@@ -142,7 +137,7 @@ namespace Catch {
}
// Write test cases
- for( auto const& child : groupNode.children )
+ for( auto const& child : testRunNode.children )
writeTestCase( *child );
xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite ), XmlFormatting::Newline );
diff --git a/src/catch2/reporters/catch_reporter_junit.hpp b/src/catch2/reporters/catch_reporter_junit.hpp
index 4f8cdbf2..752ec274 100644
--- a/src/catch2/reporters/catch_reporter_junit.hpp
+++ b/src/catch2/reporters/catch_reporter_junit.hpp
@@ -27,19 +27,15 @@ namespace Catch {
void testRunStarting(TestRunInfo const& runInfo) override;
- void testGroupStarting(GroupInfo const& groupInfo) override;
-
void testCaseStarting(TestCaseInfo const& testCaseInfo) override;
bool assertionEnded(AssertionStats const& assertionStats) override;
void testCaseEnded(TestCaseStats const& testCaseStats) override;
- void testGroupEnded(TestGroupStats const& testGroupStats) override;
-
void testRunEndedCumulative() override;
private:
- void writeGroup(TestGroupNode const& groupNode, double suiteTime);
+ void writeRun(TestRunNode const& testRunNode, double suiteTime);
void writeTestCase(TestCaseNode const& testCaseNode);
diff --git a/src/catch2/reporters/catch_reporter_listening.cpp b/src/catch2/reporters/catch_reporter_listening.cpp
index 714a349c..74cfd0aa 100644
--- a/src/catch2/reporters/catch_reporter_listening.cpp
+++ b/src/catch2/reporters/catch_reporter_listening.cpp
@@ -69,14 +69,6 @@ namespace Catch {
m_reporter->testRunStarting( testRunInfo );
}
- void ListeningReporter::testGroupStarting( GroupInfo const& groupInfo ) {
- for ( auto& listener : m_listeners ) {
- listener->testGroupStarting( groupInfo );
- }
- m_reporter->testGroupStarting( groupInfo );
- }
-
-
void ListeningReporter::testCaseStarting( TestCaseInfo const& testInfo ) {
for ( auto& listener : m_listeners ) {
listener->testCaseStarting( testInfo );
@@ -120,13 +112,6 @@ namespace Catch {
m_reporter->testCaseEnded( testCaseStats );
}
- void ListeningReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {
- for ( auto& listener : m_listeners ) {
- listener->testGroupEnded( testGroupStats );
- }
- m_reporter->testGroupEnded( testGroupStats );
- }
-
void ListeningReporter::testRunEnded( TestRunStats const& testRunStats ) {
for ( auto& listener : m_listeners ) {
listener->testRunEnded( testRunStats );
diff --git a/src/catch2/reporters/catch_reporter_listening.hpp b/src/catch2/reporters/catch_reporter_listening.hpp
index 114a63a4..d00320b0 100644
--- a/src/catch2/reporters/catch_reporter_listening.hpp
+++ b/src/catch2/reporters/catch_reporter_listening.hpp
@@ -40,7 +40,6 @@ namespace Catch {
void benchmarkFailed( StringRef error ) override;
void testRunStarting( TestRunInfo const& testRunInfo ) override;
- void testGroupStarting( GroupInfo const& groupInfo ) override;
void testCaseStarting( TestCaseInfo const& testInfo ) override;
void sectionStarting( SectionInfo const& sectionInfo ) override;
void assertionStarting( AssertionInfo const& assertionInfo ) override;
@@ -49,7 +48,6 @@ namespace Catch {
bool assertionEnded( AssertionStats const& assertionStats ) override;
void sectionEnded( SectionStats const& sectionStats ) override;
void testCaseEnded( TestCaseStats const& testCaseStats ) override;
- void testGroupEnded( TestGroupStats const& testGroupStats ) override;
void testRunEnded( TestRunStats const& testRunStats ) override;
void skipTest( TestCaseInfo const& testInfo ) override;
diff --git a/src/catch2/reporters/catch_reporter_sonarqube.cpp b/src/catch2/reporters/catch_reporter_sonarqube.cpp
index a450a806..25f6964c 100644
--- a/src/catch2/reporters/catch_reporter_sonarqube.cpp
+++ b/src/catch2/reporters/catch_reporter_sonarqube.cpp
@@ -22,20 +22,17 @@ namespace Catch {
xml.writeAttribute("version"_sr, '1');
}
- void SonarQubeReporter::testGroupEnded(TestGroupStats const& testGroupStats) {
- CumulativeReporterBase::testGroupEnded(testGroupStats);
- writeGroup(*m_testGroups.back());
- }
-
- void SonarQubeReporter::writeGroup(TestGroupNode const& groupNode) {
+ void SonarQubeReporter::writeRun( TestRunNode const& runNode ) {
std::map<std::string, std::vector<TestCaseNode const*>> testsPerFile;
- for ( auto const& child : groupNode.children ) {
+
+ for ( auto const& child : runNode.children ) {
testsPerFile[child->value.testInfo->lineInfo.file].push_back(
child.get() );
}
- for (auto const& kv : testsPerFile)
- writeTestFile(kv.first, kv.second);
+ for ( auto const& kv : testsPerFile ) {
+ writeTestFile( kv.first, kv.second );
+ }
}
void SonarQubeReporter::writeTestFile(std::string const& filename, std::vector<TestCaseNode const*> const& testCaseNodes) {
diff --git a/src/catch2/reporters/catch_reporter_sonarqube.hpp b/src/catch2/reporters/catch_reporter_sonarqube.hpp
index d46cb422..f48d6406 100644
--- a/src/catch2/reporters/catch_reporter_sonarqube.hpp
+++ b/src/catch2/reporters/catch_reporter_sonarqube.hpp
@@ -32,15 +32,17 @@ namespace Catch {
void noMatchingTestCases(std::string const& /*spec*/) override {}
- void testRunStarting(TestRunInfo const& testRunInfo) override;
-
- void testGroupEnded(TestGroupStats const& testGroupStats) override;
+ void testRunStarting( TestRunInfo const& testRunInfo ) override;
void testRunEndedCumulative() override {
+ // HACK: There can only be one testRunNode? This needs to be
+ // refactored after the group nodes are excised.
+ assert( m_testRuns.size() == 1 );
+ writeRun( m_testRuns.back() );
xml.endElement();
}
- void writeGroup(TestGroupNode const& groupNode);
+ void writeRun( TestRunNode const& groupNode );
void writeTestFile(std::string const& filename, std::vector<TestCaseNode const*> const& testCaseNodes);
diff --git a/src/catch2/reporters/catch_reporter_streaming_base.cpp b/src/catch2/reporters/catch_reporter_streaming_base.cpp
index d0b8ae94..1c2787ca 100644
--- a/src/catch2/reporters/catch_reporter_streaming_base.cpp
+++ b/src/catch2/reporters/catch_reporter_streaming_base.cpp
@@ -17,18 +17,8 @@ namespace Catch {
currentTestRunInfo = _testRunInfo;
}
- void
- StreamingReporterBase::testGroupStarting( GroupInfo const& _groupInfo ) {
- currentGroupInfo = _groupInfo;
- }
-
- void StreamingReporterBase::testGroupEnded( TestGroupStats const& ) {
- currentGroupInfo.reset();
- }
-
void StreamingReporterBase::testRunEnded( TestRunStats const& ) {
currentTestCaseInfo = nullptr;
- currentGroupInfo.reset();
currentTestRunInfo.reset();
}
diff --git a/src/catch2/reporters/catch_reporter_streaming_base.hpp b/src/catch2/reporters/catch_reporter_streaming_base.hpp
index b0f1dd49..ddd10c5e 100644
--- a/src/catch2/reporters/catch_reporter_streaming_base.hpp
+++ b/src/catch2/reporters/catch_reporter_streaming_base.hpp
@@ -48,8 +48,6 @@ namespace Catch {
void testRunStarting( TestRunInfo const& _testRunInfo ) override;
- void testGroupStarting( GroupInfo const& _groupInfo ) override;
-
void testCaseStarting(TestCaseInfo const& _testInfo) override {
currentTestCaseInfo = &_testInfo;
}
@@ -63,7 +61,6 @@ namespace Catch {
void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override {
currentTestCaseInfo = nullptr;
}
- void testGroupEnded( TestGroupStats const& ) override;
void testRunEnded( TestRunStats const& /* _testRunStats */ ) override;
void skipTest(TestCaseInfo const&) override {
@@ -78,7 +75,6 @@ namespace Catch {
std::ostream& stream;
LazyStat<TestRunInfo> currentTestRunInfo;
- LazyStat<GroupInfo> currentGroupInfo;
TestCaseInfo const* currentTestCaseInfo = nullptr;
std::vector<SectionInfo> m_sectionStack;
diff --git a/src/catch2/reporters/catch_reporter_teamcity.cpp b/src/catch2/reporters/catch_reporter_teamcity.cpp
index 3a417bd4..6cb15d5d 100644
--- a/src/catch2/reporters/catch_reporter_teamcity.cpp
+++ b/src/catch2/reporters/catch_reporter_teamcity.cpp
@@ -46,16 +46,14 @@ namespace Catch {
TeamCityReporter::~TeamCityReporter() {}
<