Struct cucumber::runner::Basic

source ·
pub struct Basic<World, F = WhichScenarioFn, Before = BeforeHookFn<World>, After = AfterHookFn<World>> { /* private fields */ }
Expand description

Default Runner implementation which follows order guarantees from the Runner trait docs.

Executes Scenarios concurrently based on the custom function, which returns ScenarioType. Also, can limit maximum number of concurrent Scenarios.

Implementations§

source§

impl<World, Which, Before, After> Basic<World, Which, Before, After>

source

pub fn max_concurrent_scenarios(self, max: impl Into<Option<usize>>) -> Self

If max is Some, then number of concurrently executed Scenarios will be limited.

source

pub fn retries(self, retries: impl Into<Option<usize>>) -> Self

If retries is Some, then failed Scenarios will be retried specified number of times.

source

pub fn retry_after(self, after: impl Into<Option<Duration>>) -> Self

If after is Some, then failed Scenarios will be retried after the specified Duration.

source

pub fn retry_filter( self, tag_expression: impl Into<Option<TagOperation>> ) -> Self

If filter is Some, then failed Scenarios will be retried only if they’re matching the specified tag_expression.

source

pub const fn fail_fast(self) -> Self

Makes stop running tests on the first failure.

NOTE: All the already started Scenarios at the moment of failure will be finished.

NOTE: Retried Scenarios are considered as failed, only in case they exhaust all retry attempts and still fail.

source

pub fn which_scenario<F>(self, func: F) -> Basic<World, F, Before, After>
where F: Fn(&Feature, Option<&Rule>, &Scenario) -> ScenarioType + 'static,

Function determining whether a Scenario is Concurrent or a Serial one.

source

pub fn retry_options<R>(self, func: R) -> Self
where R: Fn(&Feature, Option<&Rule>, &Scenario, &Cli) -> Option<RetryOptions> + 'static,

Function determining Scenario’s RetryOptions.

source

pub fn before<Func>(self, func: Func) -> Basic<World, Which, Func, After>
where Func: for<'a> Fn(&'a Feature, Option<&'a Rule>, &'a Scenario, &'a mut World) -> LocalBoxFuture<'a, ()>,

Sets a hook, executed on each Scenario before running all its Steps, including Background ones.

source

pub fn after<Func>(self, func: Func) -> Basic<World, Which, Before, Func>
where Func: for<'a> Fn(&'a Feature, Option<&'a Rule>, &'a Scenario, &'a ScenarioFinished, Option<&'a mut World>) -> LocalBoxFuture<'a, ()>,

Sets hook, executed on each Scenario after running all its Steps, even after Skipped of Failed ones.

Last World argument is supplied to the function, in case it was initialized before by running before hook or any Step.

source

pub fn steps(self, steps: Collection<World>) -> Self

Sets the given Collection of Steps to this Runner.

source

pub fn given(self, regex: Regex, step: Step<World>) -> Self

Adds a Given Step matching the given regex.

source

pub fn when(self, regex: Regex, step: Step<World>) -> Self

Adds a When Step matching the given regex.

source

pub fn then(self, regex: Regex, step: Step<World>) -> Self

Adds a Then Step matching the given regex.

Trait Implementations§

source§

impl<World, F: Clone, B: Clone, A: Clone> Clone for Basic<World, F, B, A>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<World, F, B, A> Debug for Basic<World, F, B, A>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<World> Default for Basic<World>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
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

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

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

Output events [Stream].
source§

fn run<S>(self, features: S, cli: 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.

Auto Trait Implementations§

§

impl<World, F = fn(_: &Feature, _: Option<&Rule>, _: &Scenario) -> ScenarioType, Before = for<'a> fn(_: &'a Feature, _: Option<&'a Rule>, _: &'a Scenario, _: &'a mut World) -> Pin<Box<dyn Future<Output = ()> + 'a>>, After = for<'a> fn(_: &'a Feature, _: Option<&'a Rule>, _: &'a Scenario, _: &'a ScenarioFinished, _: Option<&'a mut World>) -> Pin<Box<dyn Future<Output = ()> + 'a>>> !RefUnwindSafe for Basic<World, F, Before, After>

§

impl<World, F = fn(_: &Feature, _: Option<&Rule>, _: &Scenario) -> ScenarioType, Before = for<'a> fn(_: &'a Feature, _: Option<&'a Rule>, _: &'a Scenario, _: &'a mut World) -> Pin<Box<dyn Future<Output = ()> + 'a>>, After = for<'a> fn(_: &'a Feature, _: Option<&'a Rule>, _: &'a Scenario, _: &'a ScenarioFinished, _: Option<&'a mut World>) -> Pin<Box<dyn Future<Output = ()> + 'a>>> !Send for Basic<World, F, Before, After>

§

impl<World, F = fn(_: &Feature, _: Option<&Rule>, _: &Scenario) -> ScenarioType, Before = for<'a> fn(_: &'a Feature, _: Option<&'a Rule>, _: &'a Scenario, _: &'a mut World) -> Pin<Box<dyn Future<Output = ()> + 'a>>, After = for<'a> fn(_: &'a Feature, _: Option<&'a Rule>, _: &'a Scenario, _: &'a ScenarioFinished, _: Option<&'a mut World>) -> Pin<Box<dyn Future<Output = ()> + 'a>>> !Sync for Basic<World, F, Before, After>

§

impl<World, F, Before, After> Unpin for Basic<World, F, Before, After>
where After: Unpin, Before: Unpin, F: Unpin,

§

impl<World, F = fn(_: &Feature, _: Option<&Rule>, _: &Scenario) -> ScenarioType, Before = for<'a> fn(_: &'a Feature, _: Option<&'a Rule>, _: &'a Scenario, _: &'a mut World) -> Pin<Box<dyn Future<Output = ()> + 'a>>, After = for<'a> fn(_: &'a Feature, _: Option<&'a Rule>, _: &'a Scenario, _: &'a ScenarioFinished, _: Option<&'a mut World>) -> Pin<Box<dyn Future<Output = ()> + 'a>>> !UnwindSafe for Basic<World, F, Before, After>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Ext for T

source§

fn assert_normalized(self) -> AssertNormalized<T>

Asserts this Writer being Normalized. Read more
source§

fn normalized<W>(self) -> Normalize<W, T>

Wraps this Writer into a Normalized version. Read more
source§

fn summarized(self) -> Summarize<T>

Wraps this Writer to print a summary at the end of an output. Read more
source§

fn fail_on_skipped(self) -> FailOnSkipped<T>

Wraps this Writer to fail on Skipped Steps if their Scenario isn’t marked with @allow.skipped tag. Read more
source§

fn fail_on_skipped_with<F>(self, f: F) -> FailOnSkipped<T, F>
where F: Fn(&Feature, Option<&Rule>, &Scenario) -> bool,

Wraps this Writer to fail on Skipped Steps if the given with predicate returns true. Read more
source§

fn repeat_skipped<W>(self) -> Repeat<W, T>

Wraps this Writer to re-output Skipped Steps at the end of an output.
source§

fn repeat_failed<W>(self) -> Repeat<W, T>

Wraps this Writer to re-output Failed Steps or Parser errors at the end of an output.
source§

fn repeat_if<W, F>(self, filter: F) -> Repeat<W, T, F>
where F: Fn(&Result<Event<Cucumber<W>>, Error>) -> bool,

Wraps this Writer to re-output filtered events at the end of an output.
source§

fn tee<W, Wr>(self, other: Wr) -> Tee<T, Wr>
where Wr: Writer<W>,

Attaches the provided other Writer to the current one for passing events to both of them simultaneously.
source§

fn discard_arbitrary_writes(self) -> Arbitrary<T>

Wraps this Writer into a discard::Arbitrary one, providing a no-op ArbitraryWriter implementation. Read more
source§

fn discard_stats_writes(self) -> Stats<T>

Wraps this Writer into a discard::Stats one, providing a no-op StatsWriter implementation returning only 0. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more