返回 CodeWhale
epic_acceptance_harness.rs
根目录 / crates / tui / tests / epic_acceptance_harness.rs
1 //! EPIC acceptance harness smoke test.
2 //!
3 //! Proves that the Gherkin/Cucumber infrastructure is available and functional
4 //! on the target branch.
5
6 use cucumber::{World as _, given, then, when, writer::Stats as _};
7
8 const FEATURE_NAME: &str = "EPIC acceptance harness";
9 const FEATURE_PATH: &str = concat!(
10 env!("CARGO_MANIFEST_DIR"),
11 "/tests/features/epic_acceptance_harness.feature"
12 );
13 const SMOKE_SCENARIO: &str = "Gherkin acceptance tests can run on the target branch";
14
15 #[derive(Debug, Default, cucumber::World)]
16 struct EpicAcceptanceWorld;
17
18 #[given("the acceptance harness is available")]
19 fn acceptance_harness_available(_world: &mut EpicAcceptanceWorld) {}
20
21 #[when("the runner discovers EPIC scenarios")]
22 fn runner_discovers_epic_scenarios(_world: &mut EpicAcceptanceWorld) {}
23
24 #[then("the runner exits successfully")]
25 fn runner_exits_successfully(_world: &mut EpicAcceptanceWorld) {}
26
27 #[tokio::test(flavor = "current_thread")]
28 async fn acceptance_harness_smoke_test() {
29 let writer = EpicAcceptanceWorld::cucumber()
30 .fail_on_skipped()
31 .with_default_cli()
32 .filter_run(FEATURE_PATH, move |feature, _, scenario| {
33 feature.name == FEATURE_NAME && scenario.name == SMOKE_SCENARIO
34 })
35 .await;
36 assert_eq!(
37 writer.failed_steps(),
38 0,
39 "scenario failed: {SMOKE_SCENARIO}"
40 );
41 assert_eq!(
42 writer.skipped_steps(),
43 0,
44 "scenario skipped steps: {SMOKE_SCENARIO}"
45 );
46 assert_eq!(
47 writer.passed_steps(),
48 3,
49 "scenario did not run: {SMOKE_SCENARIO}"
50 );
51 }
52
52 lines RUST