Skip to content

Commit 15f9e57

Browse files
committed
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.
1 parent c987e42 commit 15f9e57

File tree

5 files changed

+33
-1
lines changed

5 files changed

+33
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Each of these examples isolates a simple case of using Cucumber with the events plugin, showing
2+
the expected events output in the `expected-events.ndjson`.
3+
4+
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.
5+
To run a test manually, `cd` into the directory of the example, then run:
6+
7+
```
8+
bundle exec cucumber -r . --format Cucumber::Formatter::EventStream::Plugin
9+
```
10+
11+
Note that a certain amount of normalisation (for timestamps and directory paths) is neccesary before comparing the output for testing.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{"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"}}
2+
{"type":"test-run-started","workingDirectory":"{{Dir.pwd}}/examples/scenario-outline","timestamp":1494880725}
3+
{"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}}]}
4+
{"type":"test-case-started","sourceLocation":{"uri":"features/passing_outline.feature","line":7}}
5+
{"type":"test-step-started","testCase":{"sourceLocation":{"uri":"features/passing_outline.feature","line":7}},"index":0}
6+
{"type":"test-step-finished","testCase":{"sourceLocation":{"uri":"features/passing_outline.feature","line":7}},"index":0,"result":{"status":"passed","duration":5000}}
7+
{"type":"test-step-started","testCase":{"sourceLocation":{"uri":"features/passing_outline.feature","line":7}},"index":1}
8+
{"type":"test-step-finished","testCase":{"sourceLocation":{"uri":"features/passing_outline.feature","line":7}},"index":1,"result":{"status":"passed","duration":200000}}
9+
{"type":"test-case-finished","sourceLocation":{"uri":"features/passing_outline.feature","line":7},"result":{"status":"passed","duration":38645000}}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Feature:
2+
Scenario Outline:
3+
Given this step is <status>
4+
5+
Examples:
6+
| status |
7+
| passing |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Given(/pass/) do
2+
# noop
3+
end

event-protocol/ruby/spec/cucumber/formatter/event_stream_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@
5858
describe "examples" do
5959

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

6365
examples.each do |example_dir|
6466

0 commit comments

Comments
 (0)