Trait cucumber::Runner

source ·
pub trait Runner<World> {
    type Cli: Args;
    type EventStream: Stream<Item = Result<Event<Cucumber<World>>>>;

    // Required method
    fn run<S>(self, features: S, cli: Self::Cli) -> Self::EventStream
       where S: Stream<Item = Result<Feature>> + 'static;
}
Expand description

Executor of Parser output producing Cucumber events for Writer.

§Order guarantees

Implementors are expected to source events in a happened-before order. For example event::Scenario::Started for a single Scenario should predate any other events of this Scenario, while event::Scenario::Finished should be the last one. Step events of this Scenario should be emitted in order of declaration in .feature file. But as Scenarios can be executed concurrently, events from one Scenario can be interrupted by events of a different one (which are also following the happened-before order). Those rules are applied also to Rules and Features. If you want to avoid those interruptions for some Scenario, it should be resolved as ScenarioType::Serial by the Runner.

Because of that, Writer, accepting events produced by a Runner has to be Normalized.

All those rules are considered in a Basic reference Runner implementation.

Required Associated Types§

source

type Cli: Args

CLI options of this Runner. In case no options should be introduced, just use cli::Empty.

All CLI options from Parser, Runner and Writer will be merged together, so overlapping arguments will cause a runtime panic.

source

type EventStream: Stream<Item = Result<Event<Cucumber<World>>>>

Output events Stream.

Required Methods§

source

fn run<S>(self, features: S, cli: Self::Cli) -> Self::EventStream
where S: Stream<Item = Result<Feature>> + 'static,

Executes the given Stream of Features transforming it into a Stream of executed Cucumber events.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<W, Which, Before, After> Runner<W> for Basic<W, Which, Before, After>
where W: World, Which: Fn(&Feature, Option<&Rule>, &Scenario) -> ScenarioType + 'static, Before: for<'a> Fn(&'a Feature, Option<&'a Rule>, &'a Scenario, &'a mut W) -> LocalBoxFuture<'a, ()> + 'static, After: for<'a> Fn(&'a Feature, Option<&'a Rule>, &'a Scenario, &'a ScenarioFinished, Option<&'a mut W>) -> LocalBoxFuture<'a, ()> + 'static,

§

type Cli = Cli

§

type EventStream = Pin<Box<dyn Stream<Item = Result<Event<Cucumber<W>>, Error>>>>