output_sink rendering the run as JUnit XML, the de facto standard consumed by Jenkins, GitLab CI, CircleCI, Azure DevOps, Bitbucket Pipelines and most CI dashboards. More...
output_sink rendering the run as JUnit XML, the de facto standard consumed by Jenkins, GitLab CI, CircleCI, Azure DevOps, Bitbucket Pipelines and most CI dashboards.
Built from output_sink's structured hooks rather than by parsing the human-readable text tts::stdout_sink prints, so it stays correct regardless of -v/-q. Every TTS_CASE becomes one <testcase> (name, classname, elapsed time in seconds) inside a single <testsuite>, with a <skipped/> child for an invalid case or a <failure> child gathering every failing assertion's message for a failed one. Rendered by dump(), or automatically via finish(), to the target given at construction (tts::output_handler::default_sink() by default). It does not (currently) reflect TTS_CASE_TPL's per-type breakdown or TTS_WHEN / TTS_AND_THEN sub-scenarios, since those don't have their own hook - only the enclosing TTS_CASE does.
Public Member Functions | |
| void | assertion_failed (text const &location, text const &message, bool fatal) override |
| void | clear () |
| Discards everything gathered so far. | |
| void | dump () |
| Streams the JUnit-rendered report to stdout, then clears the gathered results. | |
| void | dump (output_sink &target) |
| Forwards the JUnit-rendered report to target, then clears the gathered results. | |
| void | finish () override |
| Dumps the JUnit-rendered report to the target given at construction. | |
| virtual void | flush () |
| Flushes this sink's destination, if that means anything for it. No-op by default. | |
| text | render () const |
| Renders everything gathered so far as a single JUnit XML document. | |
| virtual void | suite_aborted () |
| virtual void | suite_finished (unsigned long long fail_count, unsigned long long invalid_count) |
| virtual void | suite_metric (outcome kind, unsigned long long count, unsigned long long total) |
| void | test_finished (text const &name, bool passed, bool invalid, unsigned long long duration_ns) override |
| virtual void | test_started (text const &name) |
| void | write (text const &) override |
| Writes t to this sink's destination. | |
|
inlineoverridevirtual |
Called once per failing/fatal assertion, always and before the corresponding text (if any - it's suppressed under -q for a plain failure, though never for a fatal one). No-op by default. Not called for passing assertions - test_finished()'s passed already covers that case, and most consumers of this hook don't want one event per assertion.
Reimplemented from tts::output_sink.
|
inlinevirtualinherited |
Called if the suite aborts early due to a TTS_FATAL failure, before tts::report() (and thus suite_finished()) runs. No-op by default.
Reimplemented in tts::colorized_sink.
|
inlinevirtualinherited |
Called once the whole suite has finished running (from tts::report()), with its aggregate outcome, always - even under -q. No-op by default.
Reimplemented in tts::colorized_sink.
|
inlinevirtualinherited |
Called once per non-zero outcome category, right before its "N/M (P%) <label>" segment is printed as part of the Results: ... summary. No-op by default.
Reimplemented in tts::colorized_sink.
|
inlineoverridevirtual |
Called once a TTS_CASE / TTS_CASE_TPL / TTS_CASE_WITH has finished running, always and before its corresponding text (if any - suppressed under -q), with its outcome and how long it took to run, in nanoseconds. No-op by default.
Reimplemented from tts::output_sink.
|
inlinevirtualinherited |
Called when a TTS_CASE / TTS_CASE_TPL / TTS_CASE_WITH is about to run. No-op by default - opt-in for sinks that want structured per-test events instead of (or in addition to) parsing the formatted text stream.
Reimplemented in tts::colorized_sink.