#[non_exhaustive]pub struct TestReport<'t, FmtError: 't> {
pub outcomes: TestOutcomes<'t>,
pub duration: Duration,
pub fmt_errors: Vec<(FormatError, FmtError)>,
}Expand description
The report produced by running a TestHarness.
TestReport is returned by TestHarness::run.
It contains all outcomes of the test run, the total time spent executing the harness, and any
errors reported by the formatter.
The recorded duration only covers the time spent inside the harness itself.
Any work done before calling run (for example test discovery or data loading)
is not included and must be tracked separately if needed.
Formatter errors are collected instead of aborting the run early. This allows test execution to complete even if formatting fails partway through.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.outcomes: TestOutcomes<'t>Outcomes of all executed tests.
duration: DurationTotal duration of the test run.
fmt_errors: Vec<(FormatError, FmtError)>Errors reported by the formatter.
Each entry contains the formatting stage and the formatter specific error.
Implementations§
Source§impl<'t, FmtError: 't> TestReport<'t, FmtError>
impl<'t, FmtError: 't> TestReport<'t, FmtError>
Sourcepub fn exit_code(&self) -> ExitCode
pub fn exit_code(&self) -> ExitCode
Compute the process exit code for this test report.
The exit code is determined as follows:
- If any test failed, the exit code is
ExitCode::FAILURE - Otherwise, if any formatter errors occurred, the exit code is
ExitCode::FAILURE - Otherwise, the exit code is
ExitCode::SUCCESS
This mirrors the behavior of the built in Rust test harness, where formatting errors are treated as fatal.