pub struct Scenario { /* private fields */ }Expand description
A ready scenario: an explicit fixture the test holds.
Dropping the scenario tears down anything the harness created for the
network (a managed local node is force-killed (SIGKILL) as a backstop);
Scenario::stop does the same gracefully and reports teardown errors.
Implementations§
Source§impl Scenario
impl Scenario
Sourcepub fn builder(seed: impl Into<String>) -> ScenarioBuilder
pub fn builder(seed: impl Into<String>) -> ScenarioBuilder
Start building a scenario with the given deterministic seed.
Sourcepub async fn run_agents<I>(&self, agents: I) -> Result<ScenarioReport>where
I: IntoIterator<Item = Agent>,
pub async fn run_agents<I>(&self, agents: I) -> Result<ScenarioReport>where
I: IntoIterator<Item = Agent>,
Run a set of agents concurrently, returning once all have finished.
Each agent is assigned a distinct account (by position), its own
deterministic random stream, and a mailbox. After every non-panicking
agent finishes, returned errors are aggregated in
TestkitError::AgentsFailed. An agent panic (for example a failed
assertion) propagates immediately.
May be called more than once on the same scenario: each call runs in a fresh nonce namespace, so a later run against the same accounts does not collide with an earlier run’s transactions.