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ý2024-08-14 12:32:44 +0200
committerMartin Hořeňovský2024-08-14 12:33:55 +0200
commitfa306fc85eca7cc68a5362c503019fa823cbe411 (patch)
tree31afcdf2ef001ed50061807762c2a42b1fb2903e /src/catch2
parent35c3403fbbff09062b8b2ab035aaf571b3064fa4 (diff)
downloadcatch3-fa306fc85eca7cc68a5362c503019fa823cbe411.tar.gz
Improve performance of SonarQube reporter handling passing assertions
This mirrors the changes done to the JUnit reporter in commit fe483c056d9516d3550519c29fbf14a4d84d06d4
Diffstat (limited to 'src/catch2')
-rw-r--r--src/catch2/reporters/catch_reporter_sonarqube.cpp4
-rw-r--r--src/catch2/reporters/catch_reporter_sonarqube.hpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/catch2/reporters/catch_reporter_sonarqube.cpp b/src/catch2/reporters/catch_reporter_sonarqube.cpp
index 9c391b1f..2c3eb1cd 100644
--- a/src/catch2/reporters/catch_reporter_sonarqube.cpp
+++ b/src/catch2/reporters/catch_reporter_sonarqube.cpp
@@ -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));
diff --git a/src/catch2/reporters/catch_reporter_sonarqube.hpp b/src/catch2/reporters/catch_reporter_sonarqube.hpp
index 906578bb..509f411e 100644
--- a/src/catch2/reporters/catch_reporter_sonarqube.hpp
+++ b/src/catch2/reporters/catch_reporter_sonarqube.hpp
@@ -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;
}