Skip to content

Installation (Rust)

Terminal window
cargo add executable-stories

Requires Rust edition 2021 and version 1.75 or later.

If you want OpenTelemetry tracing support, enable the optional otel feature:

Terminal window
cargo add executable-stories --features otel

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.

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 failure

Pass the raw run JSON to executable-stories-formatters to render Markdown, HTML, JUnit XML, or Cucumber formats:

Terminal window
npx executable-stories-formatters format --input .executable-stories/raw-run.json --format markdown

Install the formatters package once in your Node project or CI job:

Terminal window
npm install -D executable-stories-formatters

First Story (Rust) — write your first Rust scenario.

Rust story & doc API — steps, docs, and adapter options.