Skip to content

Commit

Permalink
Improve performance of SonarQube reporter handling passing assertions
Browse files Browse the repository at this point in the history
This mirrors the changes done to the JUnit reporter in commit
fe483c0
  • Loading branch information
horenmar committed Aug 14, 2024
1 parent 35c3403 commit fa306fc
Show file tree
Hide file tree
Showing 4 changed files with 311 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/catch2/reporters/catch_reporter_sonarqube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ namespace Catch {
if (!rootName.empty())
name = rootName + '/' + name;

if ( sectionNode.hasAnyAssertions()
if ( sectionNode.stats.assertions.total() > 0
|| !sectionNode.stdOut.empty()
|| !sectionNode.stdErr.empty() ) {
|| !sectionNode.stdErr.empty() ) {
XmlWriter::ScopedElement e = xml.scopedElement("testCase");
xml.writeAttribute("name"_sr, name);
xml.writeAttribute("duration"_sr, static_cast<long>(sectionNode.stats.durationInSeconds * 1000));
Expand Down
2 changes: 1 addition & 1 deletion src/catch2/reporters/catch_reporter_sonarqube.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Catch {
: CumulativeReporterBase(CATCH_MOVE(config))
, xml(m_stream) {
m_preferences.shouldRedirectStdOut = true;
m_preferences.shouldReportAllAssertions = true;
m_preferences.shouldReportAllAssertions = false;
m_shouldStoreSuccesfulAssertions = false;
}

Expand Down
Loading

0 comments on commit fa306fc

Please sign in to comment.