pub struct ReporterHarness { /* private fields */ }Expand description
Owns the channels and sink needed to build a Reporter for tests.
The matching event receiver and command sender are kept alive for the
harness’s lifetime, so a reporter built from Self::reporter never
sees a spurious disconnect while emitting facts.
Implementations§
Source§impl ReporterHarness
impl ReporterHarness
Sourcepub fn respond(&self, prompt_id: u64, response: Response)
pub fn respond(&self, prompt_id: u64, response: Response)
Pre-stage an operator response to a prompt the action under test will
issue. A reporter allocates prompt ids from zero in order, so the first
prompt an action issues has id 0. The response sits in the command
channel until the reporter receives it, so call this before running the
action.
Sourcepub fn reporter(&mut self, step: StepId) -> Reporter<'_>
pub fn reporter(&mut self, step: StepId) -> Reporter<'_>
Build a reporter scoped to the given step. The reporter borrows the harness for its lifetime.
The entropy source is seeded with a fixed test seed, mirroring the
runner, so actions that draw values (serials, nonces) work out of the
box. Tests that need a specific seed can call
Reporter::seed_entropy again.