Add support for multiple parallel reporters

This requires a bunch of different changes across the reporter
subsystem.

* We need to handle multiple reporters and their differing
  preferences in `ListeningReporter`, e.g. what to do when
  we mix reporters that capture and don't capture stdout.
* We need to change how the reporter is given output and
  how we parse reporter's output destination from CLI.
* Approval tests need to handle multireporter option
This commit is contained in:
Martin Jeřábek
2021-02-06 20:12:07 +01:00
committed by Martin Hořeňovský
parent 6b55f5d780
commit ccd67b293d
33 changed files with 51234 additions and 224 deletions

View File

@@ -2423,7 +2423,7 @@ ok {test-number} - config.abortAfter == -1 for: -1 == -1
# Process can be configured on command line
ok {test-number} - config.noThrow == false for: false == false
# Process can be configured on command line
ok {test-number} - config.reporterName == "console" for: "console" == "console"
ok {test-number} - config.reporterSpecifications == std::vector<Catch::ConfigData::ReporterAndFile>{ {"console", {}} } for: { { console, <default-output> } } == { { console, <default-output> } }
# Process can be configured on command line
ok {test-number} - !(cfg.hasTestFilters()) for: !false
# Process can be configured on command line
@@ -2451,24 +2451,46 @@ ok {test-number} - cfg.testSpec().matches(*fakeTestCase("test1")) == false for:
# Process can be configured on command line
ok {test-number} - cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) for: true
# Process can be configured on command line
ok {test-number} - cli.parse({"test", "-r", "console"}) for: {?}
ok {test-number} - result for: {?} with 1 message: 'result.errorMessage() := ""'
# Process can be configured on command line
ok {test-number} - config.reporterName == "console" for: "console" == "console"
ok {test-number} - config.reporterSpecifications == vec_ReporterAndFile{ {"console", {}} } for: { { console, <default-output> } } == { { console, <default-output> } } with 1 message: 'result.errorMessage() := ""'
# Process can be configured on command line
ok {test-number} - cli.parse({"test", "-r", "xml"}) for: {?}
ok {test-number} - result for: {?} with 1 message: 'result.errorMessage() := ""'
# Process can be configured on command line
ok {test-number} - config.reporterName == "xml" for: "xml" == "xml"
ok {test-number} - config.reporterSpecifications == vec_ReporterAndFile{ {"xml", {}} } for: { { xml, <default-output> } } == { { xml, <default-output> } } with 1 message: 'result.errorMessage() := ""'
# Process can be configured on command line
ok {test-number} - cli.parse({"test", "--reporter", "junit"}) for: {?}
ok {test-number} - result for: {?} with 1 message: 'result.errorMessage() := ""'
# Process can be configured on command line
ok {test-number} - config.reporterName == "junit" for: "junit" == "junit"
# Process can be configured on command line
ok {test-number} - !(cli.parse({ "test", "-r", "xml", "-r", "junit" })) for: !{?}
ok {test-number} - config.reporterSpecifications == vec_ReporterAndFile{ {"junit", {}} } for: { { junit, <default-output> } } == { { junit, <default-output> } } with 1 message: 'result.errorMessage() := ""'
# Process can be configured on command line
ok {test-number} - !result for: true
# Process can be configured on command line
ok {test-number} - result.errorMessage(), ContainsSubstring("Unrecognized reporter") for: "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" contains: "Unrecognized reporter"
# Process can be configured on command line
ok {test-number} - result for: {?} with 1 message: 'result.errorMessage() := ""'
# Process can be configured on command line
ok {test-number} - config.reporterSpecifications == vec_ReporterAndFile{ {"console", "out.txt"s} } for: { { console, out.txt } } == { { console, out.txt } } with 1 message: 'result.errorMessage() := ""'
# Process can be configured on command line
ok {test-number} - result for: {?} with 1 message: 'result.errorMessage() := ""'
# Process can be configured on command line
ok {test-number} - config.reporterSpecifications == vec_ReporterAndFile{ {"console", "C:\\Temp\\out.txt"s} } for: { { console, C:\Temp\out.txt } } == { { console, C:\Temp\out.txt } } with 1 message: 'result.errorMessage() := ""'
# Process can be configured on command line
ok {test-number} - !result for: true
# Process can be configured on command line
ok {test-number} - result.errorMessage(), ContainsSubstring("empty filename") for: "Reporter 'console' has empty filename specified as its output. Supply a filename or remove the colons to use the default output." contains: "empty filename"
# Process can be configured on command line
ok {test-number} - cli.parse({ "test", "-r", "xml::output.xml", "-r", "junit::output-junit.xml" }) for: {?}
# Process can be configured on command line
ok {test-number} - config.reporterSpecifications == vec_ReporterAndFile{ {"xml", "output.xml"s}, {"junit", "output-junit.xml"s} } for: { { xml, output.xml }, { junit, output-junit.xml } } == { { xml, output.xml }, { junit, output-junit.xml } }
# Process can be configured on command line
ok {test-number} - cli.parse({ "test", "-r", "xml::output.xml", "-r", "console" }) for: {?}
# Process can be configured on command line
ok {test-number} - config.reporterSpecifications == vec_ReporterAndFile{ {"xml", "output.xml"s}, {"console", {}} } for: { { xml, output.xml }, { console, <default-output> } } == { { xml, output.xml }, { console, <default-output> } }
# Process can be configured on command line
ok {test-number} - !result for: true
# Process can be configured on command line
ok {test-number} - result.errorMessage(), ContainsSubstring("Only one reporter may have unspecified output file.") for: "Only one reporter may have unspecified output file." contains: "Only one reporter may have unspecified output file."
# Process can be configured on command line
ok {test-number} - cli.parse({"test", "-b"}) for: {?}
# Process can be configured on command line
ok {test-number} - config.shouldDebugBreak == true for: true == true
@@ -2519,11 +2541,11 @@ ok {test-number} - config.noThrow for: true
# Process can be configured on command line
ok {test-number} - cli.parse({"test", "-o", "filename.ext"}) for: {?}
# Process can be configured on command line
ok {test-number} - config.outputFilename == "filename.ext" for: "filename.ext" == "filename.ext"
ok {test-number} - config.defaultOutputFilename == "filename.ext" for: "filename.ext" == "filename.ext"
# Process can be configured on command line
ok {test-number} - cli.parse({"test", "--out", "filename.ext"}) for: {?}
# Process can be configured on command line
ok {test-number} - config.outputFilename == "filename.ext" for: "filename.ext" == "filename.ext"
ok {test-number} - config.defaultOutputFilename == "filename.ext" for: "filename.ext" == "filename.ext"
# Process can be configured on command line
ok {test-number} - cli.parse({"test", "-abe"}) for: {?}
# Process can be configured on command line
@@ -4398,5 +4420,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
1..2198
1..2209