pub struct TestResult {
pub test_id: String,
pub outcome: TestOutcome,
pub duration: Duration,
pub stdout: String,
pub stderr: String,
pub error_message: Option<String>,
pub stack_trace: Option<String>,
pub group: Option<String>,
}Expand description
The result of executing a single test.
Contains the test outcome, timing, captured output, and any error details. Test results are collected by the orchestrator and passed to reporters.
§Serialization
Results can be serialized for caching, logging, or transmission.
Fields§
§test_id: StringThe ID of the test that was executed.
outcome: TestOutcomeThe outcome of the test execution.
duration: DurationWall-clock time the test took to execute.
stdout: StringCaptured standard output from the test.
May be empty if output capture is disabled or unsupported.
stderr: StringCaptured standard error from the test.
error_message: Option<String>Human-readable error message for failed tests.
Typically the assertion message or exception description.
stack_trace: Option<String>Full stack trace for failed tests.
Provides detailed debugging information for failures.
group: Option<String>Group name this test belongs to (for JUnit testsuite grouping).
Implementations§
Source§impl TestResult
impl TestResult
Sourcepub fn new(test_id: impl Into<String>, outcome: TestOutcome) -> Self
pub fn new(test_id: impl Into<String>, outcome: TestOutcome) -> Self
Creates a new test result for the given test ID.
Sourcepub fn with_duration(self, duration: Duration) -> Self
pub fn with_duration(self, duration: Duration) -> Self
Sets the duration.
Sourcepub fn with_stdout(self, stdout: impl Into<String>) -> Self
pub fn with_stdout(self, stdout: impl Into<String>) -> Self
Sets the stdout.
Sourcepub fn with_stderr(self, stderr: impl Into<String>) -> Self
pub fn with_stderr(self, stderr: impl Into<String>) -> Self
Sets the stderr.
Sourcepub fn with_error(self, message: impl Into<String>) -> Self
pub fn with_error(self, message: impl Into<String>) -> Self
Sets the error message.
Sourcepub fn with_stack_trace(self, trace: impl Into<String>) -> Self
pub fn with_stack_trace(self, trace: impl Into<String>) -> Self
Sets the stack trace.
Sourcepub fn with_group(self, group: impl Into<String>) -> Self
pub fn with_group(self, group: impl Into<String>) -> Self
Sets the group name for this result.
Trait Implementations§
Source§impl Clone for TestResult
impl Clone for TestResult
Source§fn clone(&self) -> TestResult
fn clone(&self) -> TestResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more