IntelliJ Rust (libtest) integration
writer::Libtest (enabled by libtest feature in Cargo.toml) allows IntelliJ Rust plugin to interpret output of cucumber tests similar to unit tests. To use it, just add Cargo configuration (current example uses cargo test --test wait --features libtest command) or run it via Cargo command. This automatically adds --format=json CLI option, which makes the cucumber's output IDE-compatible.
Example below is set up to output with the default writer::Basic if there is no --format=json option, or with writer::Libtest otherwise.
cucumber = { version = "0.20", features = ["libtest"] }
extern crate cucumber; extern crate tokio; use cucumber::{World as _, writer}; #[derive(Debug, Default, cucumber::World)] struct World; #[tokio::main] async fn main() { World::cucumber() .with_writer(writer::Libtest::or_basic()) .run("tests/features/book") .await; }

NOTE: There are currently 2 caveats with IntelliJ Rust integration:
- Because of output interpretation issue, current timing reports for individual tests are accurate only for serial tests (or for all in case
--concurrency=1CLI option is used);- Although debugger works, test window may select
Stepthat didn't trigger the breakpoint. To fix this, use--concurrency=1CLI option.
TIP: In the multi-crate Cargo workspace, to support jump-to-definition in the reported paths (step or its matcher definition) correctly, consider to define
CARGO_WORKSPACE_DIRenvironment variable in the.cargo/config.tomlfile:[env] CARGO_WORKSPACE_DIR = { value = "", relative = true }
libtest support
Only a small subset of libtest harness is supported to integrate with other tools:
- Only
--format=jsonoutput (JUnitsupport is done separately); --report-timeoption;--show-outputoption.