For large suites, it is tedious to bind each scenario manually. The
scenarios! macro scans a directory recursively for .feature files and
generates a module with a test for every Scenario found. Each test is named
after the feature file and scenario title. Identifiers are sanitized
(ASCII-only) and deduplicated by appending a numeric suffix when collisions
occur.
use rstest_bdd_macros::{given, then, when, scenarios};
#[given("a precondition")] fn precondition() {}
#[when("an action occurs")] fn action() {}
#[then("events are recorded")] fn events() {}
scenarios!("tests/features/auto");
// Only expand scenarios tagged @smoke and not marked @wip
scenarios!("tests/features/auto", tags = "@smoke and not @wip");
When tags is supplied the macro evaluates the expression against the same
union of feature, scenario, and example tags described above. Scenarios that do
not match simply do not generate a test, and outline examples drop unmatched
rows.
Generated tests cannot currently accept fixtures; use #[scenario] when
fixture injection or custom assertions are required.