pub struct Scenario { /* private fields */ }Expand description
Deterministic scenario recorder for transaction scripts.
Implementations§
Source§impl Scenario
impl Scenario
Sourcepub fn record<C, O>(
&mut self,
name: impl Into<String>,
result: &TransactionResult<C, O>,
)
pub fn record<C, O>( &mut self, name: impl Into<String>, result: &TransactionResult<C, O>, )
Records a committed transaction result under a stable step name.
Sourcepub fn record_trace(&mut self, name: impl Into<String>, trace: TransactionTrace)
pub fn record_trace(&mut self, name: impl Into<String>, trace: TransactionTrace)
Records an already-built structural transaction trace under a step name.
Sourcepub fn steps(&self) -> &[ScenarioStep]
pub fn steps(&self) -> &[ScenarioStep]
Returns all recorded steps in commit order.
Sourcepub fn step(&self, name: &str) -> Result<&ScenarioStep, ScenarioError>
pub fn step(&self, name: &str) -> Result<&ScenarioStep, ScenarioError>
Returns a named step.
Sourcepub fn assert_replay_matches(
&self,
other: &Scenario,
) -> Result<(), ScenarioError>
pub fn assert_replay_matches( &self, other: &Scenario, ) -> Result<(), ScenarioError>
Compares two scenario trace sequences structurally.
Sourcepub fn traces(&self) -> Vec<TransactionTrace>
pub fn traces(&self) -> Vec<TransactionTrace>
Returns all transaction traces in commit order.
Sourcepub fn resource_commands(&self) -> Vec<ResourceCommandTrace>
pub fn resource_commands(&self) -> Vec<ResourceCommandTrace>
Returns all resource command traces in commit order.
Sourcepub fn output_frames(&self) -> Vec<OutputFrameTrace>
pub fn output_frames(&self) -> Vec<OutputFrameTrace>
Returns all output frame traces in commit order.
Sourcepub fn assert_step_resource_commands(
&self,
name: &str,
expected: &[ResourceCommandTrace],
) -> Result<(), ScenarioError>
pub fn assert_step_resource_commands( &self, name: &str, expected: &[ResourceCommandTrace], ) -> Result<(), ScenarioError>
Asserts a named step emitted the expected resource command trace.
Sourcepub fn assert_step_output_frames(
&self,
name: &str,
expected: &[OutputFrameTrace],
) -> Result<(), ScenarioError>
pub fn assert_step_output_frames( &self, name: &str, expected: &[OutputFrameTrace], ) -> Result<(), ScenarioError>
Asserts a named step emitted the expected output frame trace.
Sourcepub fn assert_oracle<G, O>(
&self,
graph: &G,
inputs: &O::CanonicalInputs,
) -> Result<OracleCheck<O::ExpectedState>, OracleMismatch<O::ExpectedState>>where
O: FullRecomputeOracle<G>,
pub fn assert_oracle<G, O>(
&self,
graph: &G,
inputs: &O::CanonicalInputs,
) -> Result<OracleCheck<O::ExpectedState>, OracleMismatch<O::ExpectedState>>where
O: FullRecomputeOracle<G>,
Runs an app-owned oracle check through the scenario harness.
Sourcepub fn redacted(&self, redactor: &impl TraceRedactor) -> Self
pub fn redacted(&self, redactor: &impl TraceRedactor) -> Self
Returns a redacted copy of the scenario for snapshot/debug output.
Sourcepub fn to_redacted_debug_string(&self, redactor: &impl TraceRedactor) -> String
pub fn to_redacted_debug_string(&self, redactor: &impl TraceRedactor) -> String
Returns deterministic redacted debug output for snapshots.