pub struct TestInfo {Show 24 fields
pub test_id: TestId,
pub title_path: Vec<String>,
pub retry: u32,
pub worker_index: u32,
pub parallel_index: u32,
pub repeat_each_index: u32,
pub output_dir: PathBuf,
pub snapshot_dir: PathBuf,
pub snapshot_path_template: Option<String>,
pub update_snapshots: UpdateSnapshotsMode,
pub ignore_snapshots: bool,
pub attachments: Arc<Mutex<Vec<Attachment>>>,
pub steps: Arc<Mutex<Vec<TestStep>>>,
pub soft_errors: Arc<Mutex<Vec<TestFailure>>>,
pub errors: Arc<Mutex<Vec<TestFailure>>>,
pub snapshot_suffix: Arc<Mutex<String>>,
pub column: Option<u32>,
pub project: Option<ProjectConfig>,
pub config_snapshot: Option<Arc<TestConfig>>,
pub timeout: Duration,
pub tags: Vec<String>,
pub start_time: Instant,
pub event_bus: Option<EventBus>,
pub annotations: Arc<Mutex<Vec<TestAnnotation>>>,
}Expand description
Runtime test information accessible during test execution.
Mirrors Playwright’s TestInfo interface.
Fields§
§test_id: TestIdTest ID.
title_path: Vec<String>Title path: [“suite”, “subsuite”, “test name”].
retry: u32Current retry attempt (0-indexed).
worker_index: u32Worker index (0-based).
parallel_index: u32Parallel index (same as worker_index for now).
repeat_each_index: u32repeatEach index (0-based).
output_dir: PathBufOutput directory for this test’s artifacts.
snapshot_dir: PathBufSnapshot directory for this test.
snapshot_path_template: Option<String>Snapshot path template (e.g. {testDir}/__snapshots__/{testFilePath}/{arg}{ext}).
update_snapshots: UpdateSnapshotsModeSnapshot update mode.
ignore_snapshots: boolWhen true, every snapshot comparison short-circuits to a pass.
Mirrors Playwright’s --ignore-snapshots CLI flag.
attachments: Arc<Mutex<Vec<Attachment>>>Collected attachments.
steps: Arc<Mutex<Vec<TestStep>>>Collected test steps.
soft_errors: Arc<Mutex<Vec<TestFailure>>>Soft assertion errors (collected, not thrown).
errors: Arc<Mutex<Vec<TestFailure>>>Hard errors collected during test execution. The worker pushes
the primary failure here after the test body returns; afterEach
hooks observe the full list. Mirrors Playwright’s
testInfo.errors.
snapshot_suffix: Arc<Mutex<String>>Optional suffix used to differentiate snapshot files between
configurations. Mirrors Playwright’s testInfo.snapshotSuffix.
column: Option<u32>Source column number where the test is declared. The TS / Rust
discovery layers don’t parse columns yet, so this is None in
practice; surfaced for parity with Playwright’s
testInfo.column.
project: Option<ProjectConfig>Snapshot of the project entry the test belongs to. Each test in
a multi-project run sees its own project; single-project runs
see None since there’s no per-project context.
config_snapshot: Option<Arc<TestConfig>>Snapshot of the active TestConfig. Cloned at test-info
construction time so the testInfo.config accessor is cheap.
timeout: DurationTest timeout.
Tags from annotations.
start_time: InstantTest start time.
event_bus: Option<EventBus>Event bus for real-time step event emission (set by worker).
annotations: Arc<Mutex<Vec<TestAnnotation>>>Runtime annotations added via test_info.annotate().
Implementations§
Source§impl TestInfo
impl TestInfo
Sourcepub fn new_anonymous() -> Self
pub fn new_anonymous() -> Self
Create a minimal TestInfo for non-test-runner contexts (MCP, standalone).
Sourcepub async fn annotate(
&self,
type_name: impl Into<String>,
description: impl Into<String>,
)
pub async fn annotate( &self, type_name: impl Into<String>, description: impl Into<String>, )
Add a structured annotation at runtime.
Sourcepub async fn get_annotations(&self) -> Vec<TestAnnotation>
pub async fn get_annotations(&self) -> Vec<TestAnnotation>
Get all runtime annotations.
Sourcepub async fn attach(
&self,
name: String,
content_type: String,
body: AttachmentBody,
)
pub async fn attach( &self, name: String, content_type: String, body: AttachmentBody, )
Add an attachment to this test.
Sourcepub async fn add_soft_error(&self, error: TestFailure)
pub async fn add_soft_error(&self, error: TestFailure)
Record a soft assertion error (test continues, fails at end).
Sourcepub async fn has_soft_errors(&self) -> bool
pub async fn has_soft_errors(&self) -> bool
Check if any soft errors have been collected.
Sourcepub async fn drain_soft_errors(&self) -> Vec<TestFailure>
pub async fn drain_soft_errors(&self) -> Vec<TestFailure>
Drain all soft errors for final reporting.
Sourcepub async fn begin_step(
&self,
title: impl Into<String>,
category: StepCategory,
) -> StepHandle
pub async fn begin_step( &self, title: impl Into<String>, category: StepCategory, ) -> StepHandle
Begin a new step with real-time event emission.
Returns a StepHandle that must be completed via handle.end().
Emits ReporterEvent::StepStarted immediately if an event bus is available.
Sourcepub async fn begin_child_step(
&self,
title: impl Into<String>,
category: StepCategory,
parent_step_id: &str,
) -> StepHandle
pub async fn begin_child_step( &self, title: impl Into<String>, category: StepCategory, parent_step_id: &str, ) -> StepHandle
Begin a nested step (child of a parent step).
Sourcepub async fn record_step(
&self,
title: impl Into<String>,
category: StepCategory,
status: StepStatus,
duration: Duration,
error: Option<String>,
metadata: Option<Value>,
)
pub async fn record_step( &self, title: impl Into<String>, category: StepCategory, status: StepStatus, duration: Duration, error: Option<String>, metadata: Option<Value>, )
Record a step that already executed elsewhere but still needs to flow through reporter events and the stored step tree.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TestInfo
impl !RefUnwindSafe for TestInfo
impl Send for TestInfo
impl Sync for TestInfo
impl Unpin for TestInfo
impl UnsafeUnpin for TestInfo
impl !UnwindSafe for TestInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more