Improve performance of SonarQube reporter handling passing assertions

This mirrors the changes done to the JUnit reporter in commit
fe483c056d
This commit is contained in:
Martin Hořeňovský
2024-08-14 12:32:44 +02:00
parent 35c3403fbb
commit fa306fc85e
4 changed files with 311 additions and 3 deletions

View File

@@ -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));

View File

@@ -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;
}