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::{writer, World as _};

#[derive(cucumber::World, Debug, Default)]
struct World;

#[tokio::main]
async fn main() {
World::cucumber()
    .with_writer(writer::Libtest::or_basic())
    .run("tests/features/book")
    .await;
}

record

NOTE: There are currently 2 caveats with IntelliJ Rust integration:

  1. Because of output interpretation issue, current timing reports for individual tests are accurate only for serial tests (or for all in case --concurrency=1 CLI option is used);
  2. Although debugger works, test window may select Step that didn't trigger the breakpoint. To fix this, use --concurrency=1 CLI 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_DIR environment variable in the .cargo/config.toml file:

[env]
CARGO_WORKSPACE_DIR = { value = "", relative = true }

libtest support

Only a small subset of libtest harness is supported to integrate with other tools: