Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename @allow_skipped built-in tag to @allow.skipped #181

Merged
merged 12 commits into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ All user visible changes to `cucumber` crate will be documented in this file. Th
- Removed `writer::Basic` `Default` impl and change `writer::Basic::new()` return type to `writer::Normalize<writer::Basic>`. ([#162])
- Bump up [MSRV] to 1.57 for better error reporting in `const` assertions. ([cef3d480])
- Switch to [`gherkin`] crate instead of [`gherkin_rust`]. ([rev])
- Renamed `@allow_skipped` built-in tag to `@allow.skipped`. ([#181])

### Added

Expand Down Expand Up @@ -55,6 +56,7 @@ All user visible changes to `cucumber` crate will be documented in this file. Th
[#168]: /../../pull/168
[#172]: /../../pull/172
[#178]: /../../pull/178
[#181]: /../../pull/181
[#182]: /../../pull/182
[cef3d480]: /../../commit/cef3d480579190425461ddb04a1248675248351e
[rev]: /../../commit/rev-full
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ console = "0.15"
derive_more = { version = "0.99.17", features = ["as_ref", "deref", "deref_mut", "display", "error", "from", "into"], default_features = false }
either = "1.6"
futures = "0.3.17"
gherkin = "0.11"
gherkin = "0.11.1"
globwalk = "0.8.1"
itertools = "0.10"
linked-hash-map = "0.5.3"
Expand Down
2 changes: 1 addition & 1 deletion book/src/Test_Modules_Organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Avoid writing similar step definitions, as they can lead to clutter. While docum

## Managing growth

As your test suit grows, it may become harder to notice how minimal changes to `regex`es can lead to mismatched `Step`s. To avoid this, we recommend using [`Cucumber::fail_on_skipped()`](https://docs.rs/cucumber/*/cucumber/struct.Cucumber.html#method.fail_on_skipped) combining with `@allow_skipped` tag. This will allow you to mark out `Scenario`s which `Step`s are allowed to skip.
As your test suit grows, it may become harder to notice how minimal changes to `regex`es can lead to mismatched `Step`s. To avoid this, we recommend using [`Cucumber::fail_on_skipped()`](https://docs.rs/cucumber/*/cucumber/struct.Cucumber.html#method.fail_on_skipped) combining with `@allow.skipped` tag. This will allow you to mark out `Scenario`s which `Step`s are allowed to skip.

And, as time goes on, total run time of all tests can become overwhelming when you only want to test small subset of `Scenario`s. At least until you discover [`Cucumber::filter_run_and_exit()`](https://docs.rs/cucumber/*/cucumber/struct.Cucumber.html#method.filter_run_and_exit), which will allow you run only `Scenario`s marked with custom [tags](https://cucumber.io/docs/cucumber/api/#tags).

Expand Down
2 changes: 1 addition & 1 deletion codegen/tests/features/doctests.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ Feature: Doctests
Scenario: Foo
Given foo is 0

@allow_skipped
@allow.skipped
Scenario: Bar
Given foo is not bar
6 changes: 3 additions & 3 deletions src/cucumber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ where
Cli: StructOpt,
{
/// Consider [`Skipped`] steps as [`Failed`] if their [`Scenario`] isn't
/// marked with `@allow_skipped` tag.
/// marked with `@allow.skipped` tag.
///
/// It's useful option for ensuring that all the steps were covered.
///
Expand Down Expand Up @@ -487,7 +487,7 @@ where
/// </script>
///
/// To intentionally suppress some [`Skipped`] steps failing, use the
/// `@allow_skipped` tag:
/// `@allow.skipped` tag:
/// ```gherkin
/// Feature: Animal feature
///
Expand All @@ -496,7 +496,7 @@ where
/// When I feed the cat
/// Then the cat is not hungry
///
/// @allow_skipped
/// @allow.skipped
/// Scenario: If we feed a satiated dog it will not become hungry
/// Given a satiated dog
/// When I feed the dog
Expand Down
2 changes: 1 addition & 1 deletion src/writer/fail_on_skipped.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl<Writer> From<Writer> for FailOnSkipped<Writer> {
Self {
writer,
should_fail: |_, _, sc| {
!sc.tags.iter().any(|tag| tag == "allow_skipped")
!sc.tags.iter().any(|t| t == "allow.skipped")
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pub trait Ext: Sized {
fn summarized(self) -> Summarize<Self>;

/// Wraps this [`Writer`] to fail on [`Skipped`] [`Step`]s if their
/// [`Scenario`] isn't marked with `@allow_skipped` tag.
/// [`Scenario`] isn't marked with `@allow.skipped` tag.
///
/// See [`FailOnSkipped`] for more information.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Feature: output
Markdown
* item 1
* item 2
But is also supported
And even
Given is supported too

Scenario: output
Given foo is 0
When foo is 1
Then foo is 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Started
Feature(Feature { keyword: "Feature", name: "output", description: Some("Markdown\n* item 1\n* item 2\nBut is also supported\nAnd even\nGiven is supported too"), background: None, scenarios: [Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }], rules: [], tags: [], position: LineCol { line: 1, col: 1 }, }, Started)
Feature(Feature { keyword: "Feature", name: "output", description: Some("Markdown\n* item 1\n* item 2\nBut is also supported\nAnd even\nGiven is supported too"), background: None, scenarios: [Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }], rules: [], tags: [], position: LineCol { line: 1, col: 1 }, }, Scenario(Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }, Started))
Feature(Feature { keyword: "Feature", name: "output", description: Some("Markdown\n* item 1\n* item 2\nBut is also supported\nAnd even\nGiven is supported too"), background: None, scenarios: [Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }], rules: [], tags: [], position: LineCol { line: 1, col: 1 }, }, Scenario(Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }, Step(Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Started)))
Feature(Feature { keyword: "Feature", name: "output", description: Some("Markdown\n* item 1\n* item 2\nBut is also supported\nAnd even\nGiven is supported too"), background: None, scenarios: [Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }], rules: [], tags: [], position: LineCol { line: 1, col: 1 }, }, Scenario(Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }, Step(Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Passed(CaptureLocations(Locations([Some(0), Some(8), Some(7), Some(8)]))))))
Feature(Feature { keyword: "Feature", name: "output", description: Some("Markdown\n* item 1\n* item 2\nBut is also supported\nAnd even\nGiven is supported too"), background: None, scenarios: [Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }], rules: [], tags: [], position: LineCol { line: 1, col: 1 }, }, Scenario(Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }, Step(Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Started)))
Feature(Feature { keyword: "Feature", name: "output", description: Some("Markdown\n* item 1\n* item 2\nBut is also supported\nAnd even\nGiven is supported too"), background: None, scenarios: [Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }], rules: [], tags: [], position: LineCol { line: 1, col: 1 }, }, Scenario(Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }, Step(Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Passed(CaptureLocations(Locations([Some(0), Some(8), Some(7), Some(8)]))))))
Feature(Feature { keyword: "Feature", name: "output", description: Some("Markdown\n* item 1\n* item 2\nBut is also supported\nAnd even\nGiven is supported too"), background: None, scenarios: [Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }], rules: [], tags: [], position: LineCol { line: 1, col: 1 }, }, Scenario(Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }, Step(Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }, Started)))
Feature(Feature { keyword: "Feature", name: "output", description: Some("Markdown\n* item 1\n* item 2\nBut is also supported\nAnd even\nGiven is supported too"), background: None, scenarios: [Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }], rules: [], tags: [], position: LineCol { line: 1, col: 1 }, }, Scenario(Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }, Step(Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }, Passed(CaptureLocations(Locations([Some(0), Some(8), Some(7), Some(8)]))))))
Feature(Feature { keyword: "Feature", name: "output", description: Some("Markdown\n* item 1\n* item 2\nBut is also supported\nAnd even\nGiven is supported too"), background: None, scenarios: [Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }], rules: [], tags: [], position: LineCol { line: 1, col: 1 }, }, Scenario(Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }, Finished))
Feature(Feature { keyword: "Feature", name: "output", description: Some("Markdown\n* item 1\n* item 2\nBut is also supported\nAnd even\nGiven is supported too"), background: None, scenarios: [Scenario { keyword: "Scenario", name: "output", steps: [Step { keyword: "Given", ty: Given, value: "foo is 0", docstring: None, table: None, position: LineCol { line: 10, col: 5 } }, Step { keyword: "When", ty: When, value: "foo is 1", docstring: None, table: None, position: LineCol { line: 11, col: 5 } }, Step { keyword: "Then", ty: Then, value: "foo is 2", docstring: None, table: None, position: LineCol { line: 12, col: 5 } }], examples: [], tags: [], position: LineCol { line: 9, col: 3 } }], rules: [], tags: [], position: LineCol { line: 1, col: 1 }, }, Finished)
Finished
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Feature: Outline

@[email protected]
Scenario Outline: foo
Given foo is <bar1>
When foo is <bar2>
Then foo is <bar3>

@#examples() # @comment

# comment
Examples:
| bar1 | bar2 | bar3 |
| 0 | 1 | 2 |
Loading