1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Copyright (c) 2018-2026 Brendan Molloy <brendan@bbqsrc.net>,
// Ilya Solovyiov <ilya.solovyiov@gmail.com>,
// Kai Ren <tyranron@gmail.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! Tools for executing [`Step`]s.
//!
//! [Gherkin]: https://cucumber.io/docs/gherkin/reference/
use Stream;
pub use ;
use crate::;
use crate::;
/// 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 [`Scenario`]s 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
/// [`Rule`]s and [`Feature`]s. 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.
///
/// # Identity guarantees
///
/// Implementations are responsible for the returned [`event`]s to contain
/// [`Source`]d [`Feature`]s, [`Rule`]s, [`Scenario`]s and [`Step`]s uniquely
/// identifying the ones from the received [`Feature`]s, without duplicates
/// (i.e. the same [`Scenario`] pointed by two different [`Source`]s), since a
/// [`Source`] is solely identified by its pointer, which is considered by
/// [`Runner`]s operating on them.
///
/// This rule is considered in a [`Basic`] reference [`Runner`] implementation.
///
/// [`Cucumber`]: event::Cucumber
/// [`Feature`]: gherkin::Feature
/// [`Normalized`]: crate::writer::Normalized
/// [`Parser`]: crate::Parser
/// [`Rule`]: gherkin::Rule
/// [`Scenario`]: gherkin::Scenario
/// [`Writer`]: crate::Writer
///
/// [happened-before]: https://en.wikipedia.org/wiki/Happened-before