-
-
Notifications
You must be signed in to change notification settings - Fork 690
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[event-protocol] Add an example for scenario outlines.
This illustrates the problem Bjorn is talking about in #172 (comment) where we need to use two lines to represent the location of a scenario outline step but we're currently only using one.
- Loading branch information
Showing
5 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Each of these examples isolates a simple case of using Cucumber with the events plugin, showing | ||
the expected events output in the `expected-events.ndjson`. | ||
|
||
These are used in the acceptance tests in `spec/cucumber/formatter/event_stream/event_stream_spec.rb` and the real output from running cucumber is comapred with this expected output. | ||
To run a test manually, `cd` into the directory of the example, then run: | ||
|
||
``` | ||
bundle exec cucumber -r . --format Cucumber::Formatter::EventStream::Plugin | ||
``` | ||
|
||
Note that a certain amount of normalisation (for timestamps and directory paths) is neccesary before comparing the output for testing. |
9 changes: 9 additions & 0 deletions
9
event-protocol/ruby/examples/scenario-outline/expected-events.ndjson
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{"type":"source","uri":"features/passing_outline.feature","data":"Feature:\n Scenario Outline:\n Given this step is <status>\n\n Examples:\n | status |\n | passing |\n","media":{"encoding":"utf-8","type":"text/vnd.cucumber.gherkin+plain"}} | ||
{"type":"test-run-started","workingDirectory":"{{Dir.pwd}}/examples/scenario-outline","timestamp":1494880725} | ||
{"type":"test-case-prepared","sourceLocation":{"uri":"features/passing_outline.feature","line":7},"steps":[{"actionLocation":{"uri":"{{Cucumber::LIBDIR}}/cucumber/filters/prepare_world.rb","line":28}},{"actionLocation":{"uri":"features/step_definitions/steps.rb","line":1},"sourceLocation":{"uri":"features/passing_outline.feature","line":7}}]} | ||
{"type":"test-case-started","sourceLocation":{"uri":"features/passing_outline.feature","line":7}} | ||
{"type":"test-step-started","testCase":{"sourceLocation":{"uri":"features/passing_outline.feature","line":7}},"index":0} | ||
{"type":"test-step-finished","testCase":{"sourceLocation":{"uri":"features/passing_outline.feature","line":7}},"index":0,"result":{"status":"passed","duration":5000}} | ||
{"type":"test-step-started","testCase":{"sourceLocation":{"uri":"features/passing_outline.feature","line":7}},"index":1} | ||
{"type":"test-step-finished","testCase":{"sourceLocation":{"uri":"features/passing_outline.feature","line":7}},"index":1,"result":{"status":"passed","duration":200000}} | ||
{"type":"test-case-finished","sourceLocation":{"uri":"features/passing_outline.feature","line":7},"result":{"status":"passed","duration":38645000}} |
7 changes: 7 additions & 0 deletions
7
event-protocol/ruby/examples/scenario-outline/features/passing_outline.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Feature: | ||
Scenario Outline: | ||
Given this step is <status> | ||
|
||
Examples: | ||
| status | | ||
| passing | |
3 changes: 3 additions & 0 deletions
3
event-protocol/ruby/examples/scenario-outline/features/step_definitions/steps.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Given(/pass/) do | ||
# noop | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters