Trait cucumber::World

source ·
pub trait World: Sized + 'static {
    type Error: Display;

    // Required method
    fn new() -> impl Future<Output = Result<Self, Self::Error>>;

    // Provided methods
    fn collection() -> Collection<Self>
       where Self: Debug + WorldInventory { ... }
    fn cucumber<I: AsRef<Path>>(
    ) -> Cucumber<Self, Basic, I, Basic<Self>, Summarize<Normalize<Self, Basic>>>
       where Self: Debug + WorldInventory { ... }
    fn run<I: AsRef<Path>>(input: I) -> impl Future<Output = ()>
       where Self: Debug + WorldInventory { ... }
    fn filter_run<I, F>(input: I, filter: F) -> impl Future<Output = ()>
       where Self: Debug + WorldInventory,
             I: AsRef<Path>,
             F: Fn(&Feature, Option<&Rule>, &Scenario) -> bool + 'static { ... }
}
Expand description

Represents a shared user-defined state for a Cucumber run. It lives on per-scenario basis.

This crate doesn’t provide out-of-box solution for managing state shared across scenarios, because we want some friction there to avoid tests being dependent on each other. If your workflow needs a way to share state between scenarios (ex. database connection pool), we recommend using once_cell crate or organize it other way via shared state.

Required Associated Types§

source

type Error: Display

Error of creating a new World instance.

Required Methods§

source

fn new() -> impl Future<Output = Result<Self, Self::Error>>

Creates a new World instance.

Provided Methods§

source

fn collection() -> Collection<Self>
where Self: Debug + WorldInventory,

Available on crate feature macros only.

Returns runner for tests with auto-wired steps marked by given, when and then attributes.

source

fn cucumber<I: AsRef<Path>>( ) -> Cucumber<Self, Basic, I, Basic<Self>, Summarize<Normalize<Self, Basic>>>
where Self: Debug + WorldInventory,

Available on crate feature macros only.

Returns default Cucumber with all the auto-wired Steps.

source

fn run<I: AsRef<Path>>(input: I) -> impl Future<Output = ()>
where Self: Debug + WorldInventory,

Available on crate feature macros only.

Runs Cucumber.

Features sourced by Parser are fed into Runner where the later produces events handled by Writer.

§Panics

If encountered errors while parsing Features or at least one Step panicked.

source

fn filter_run<I, F>(input: I, filter: F) -> impl Future<Output = ()>
where Self: Debug + WorldInventory, I: AsRef<Path>, F: Fn(&Feature, Option<&Rule>, &Scenario) -> bool + 'static,

Available on crate feature macros only.

Runs Cucumber with Scenarios filter.

Features sourced by Parser are fed into Runner where the later produces events handled by Writer.

§Panics

If encountered errors while parsing Features or at least one Step panicked.

Object Safety§

This trait is not object safe.

Implementors§