Installation (Rust)
Install the crate
Section titled “Install the crate”cargo add executable-storiesRequires Rust edition 2021 and version 1.75 or later.
If you want OpenTelemetry tracing support, enable the optional otel feature:
cargo add executable-stories --features otelTest suite setup
Section titled “Test suite setup”Import Story from the crate in any test file:
use executable_stories::Story;At the end of your test suite, call write_results() to flush the raw run JSON. The conventional place is a dedicated integration test or a #[test] that runs last:
#[cfg(test)]mod tests { use executable_stories::{write_results, Story};
// ... your story tests ...
#[test] fn write_report() { write_results(); }}write_results() writes .executable-stories/raw-run.json relative to the working directory. Run your tests from the crate root so the file lands in the expected location.
Marking tests as passed
Section titled “Marking tests as passed”Every Story must be explicitly marked as passed by calling .pass(). If .pass() is not called before the value is dropped, the scenario is recorded as failed.
let mut s = Story::new("my scenario");s.given("the system is ready");// ... test logic ...s.pass(); // required — omitting this records a failureGenerate a report
Section titled “Generate a report”Pass the raw run JSON to executable-stories-formatters to render Markdown, HTML, JUnit XML, or Cucumber formats:
npx executable-stories-formatters format --input .executable-stories/raw-run.json --format markdownInstall the formatters package once in your Node project or CI job:
npm install -D executable-stories-formattersFirst Story (Rust) — write your first Rust scenario.
Rust story & doc API — steps, docs, and adapter options.