2

I can run a Catch executable with -o junit --output catch_results.xml to generate an xml report.

Is there some way to both generate an xml report, and also have the console output?

4

2 回答 2

2

Assuming you are asking for having a JUnit output in a file and the standard console reporter at stdout, there is no way to do that.

Catch2 used to support multiple reporters, but there was no support for having them write their output to separate files/outputs, which meant that the feature was unusable and was removed until some point in the future.

于 2019-05-26T18:24:04.000 回答
2

You can implement your own Listener.
A Listener can implement 'event handlers' for certain events (test suite start/end, test case start/end, ...). In those event handlers you can output to the console (use printf instead of cout as cout can be intercepted by the test runner).

And, most importantly, your Listener can run in combination with a reporter.

https://github.com/catchorg/Catch2/blob/master/docs/event-listeners.md

于 2019-10-08T14:28:41.093 回答