diff options
| author | Martin Hořeňovský | 2022-10-26 00:05:00 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2022-10-26 00:05:00 +0200 |
| commit | ffa152095ce075499b299e4872ecb1c1ea1a4dbf (patch) | |
| tree | 42397a9eb0d3058ebab89bf50a7402a392e1751d /src | |
| parent | 0ce8c25566176acbce2e887445d8c33306c184bc (diff) | |
| download | catch3-ffa152095ce075499b299e4872ecb1c1ea1a4dbf.tar.gz | |
Report used filters in the SonarQube reporter
Diffstat (limited to 'src')
| -rw-r--r-- | src/catch2/reporters/catch_reporter_sonarqube.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/catch2/reporters/catch_reporter_sonarqube.cpp b/src/catch2/reporters/catch_reporter_sonarqube.cpp index 8119c3b8..15b55ae0 100644 --- a/src/catch2/reporters/catch_reporter_sonarqube.cpp +++ b/src/catch2/reporters/catch_reporter_sonarqube.cpp @@ -11,15 +11,22 @@ #include <catch2/catch_test_case_info.hpp> #include <catch2/internal/catch_reusable_string_stream.hpp> #include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/catch_test_spec.hpp> +#include <catch2/reporters/catch_reporter_helpers.hpp> #include <map> namespace Catch { namespace { - std::string createRngSeedString(uint32_t seed) { + std::string createMetadataString(IConfig const& config) { ReusableStringStream sstr; - sstr << "rng-seed=" << seed; + if ( config.testSpec().hasFilters() ) { + sstr << "filters='" + << serializeFilters( config.getTestsOrTags() ) + << "' "; + } + sstr << "rng-seed=" << config.rngSeed(); return sstr.str(); } } @@ -27,7 +34,7 @@ namespace Catch { void SonarQubeReporter::testRunStarting(TestRunInfo const& testRunInfo) { CumulativeReporterBase::testRunStarting(testRunInfo); - xml.writeComment( createRngSeedString( m_config->rngSeed() ) ); + xml.writeComment( createMetadataString( *m_config ) ); xml.startElement("testExecutions"); xml.writeAttribute("version"_sr, '1'); } |