Skip to content

Commit

Permalink
[event-protocol] Add an example for scenario outlines.
Browse files Browse the repository at this point in the history
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
mattwynne committed May 15, 2017
1 parent c987e42 commit 6ccb76e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
11 changes: 11 additions & 0 deletions event-protocol/ruby/examples/readme.md
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.
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}}
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 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Given(/pass/) do
# noop
end
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
describe "examples" do

path = File.dirname(__FILE__) + "/../../../examples/*"
examples = Dir[path].map { |path| File.expand_path(path) }
examples = Dir[path].
map { |path| File.expand_path(path) }.
select { |path| File.directory?(path) }

examples.each do |example_dir|

Expand Down

0 comments on commit 6ccb76e

Please sign in to comment.