Skip to content

Commit

Permalink
Add example with parameterized Scenario Outline
Browse files Browse the repository at this point in the history
When using a Scenario Outline it is possible to use a placeholder in the
name of that Scenario Outline. The resulting pickle will have the
placeholder replaced with a value from the example tables.

This allows us to test use cases where this matter such as:
- cucumber/junit-xml-formatter#34
- cucumber/testng-xml-formatter#4

Fixes: #96
  • Loading branch information
mpkorstanje committed Jun 22, 2024
1 parent 971ca50 commit d68f54e
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 66 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Added
- Add example with parameterized Scenario Outline ([#98](https://github.com/cucumber/compatibility-kit/pull/98))

### Fixed
- [Ruby] Fixed a duplicate conflicting method that caused the CCK not to load feature paths ([#95](https://github.com/cucumber/compatibility-kit/pull/95))

Expand Down
20 changes: 18 additions & 2 deletions devkit/samples/examples-tables/examples-tables.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
Feature: Examples Tables
Sometimes it can be desirable to run the same scenario multiple times with
different data each time - this can be done by placing an Examples table underneath
a Scenario, and use <placeholders> in the Scenario which match the table headers.
different data each time - this can be done by placing an Examples table
underneath a Scenario, and use <placeholders> in the Scenario which match the
table headers.

The Scenario Outline name can also be parameterized. The name of the resulting
pickle will have the <placeholder> replaced with the value from the examples
table.

Scenario Outline: Eating cucumbers
Given there are <start> cucumbers
Expand All @@ -25,3 +30,14 @@ Feature: Examples Tables
| start | eat | left |
| 12 | banana | 12 |
| 0 | 1 | apple |

Scenario Outline: Eating cucumbers with <friends> friends
Given there are <friends> friends
When there are <start> cucumbers
Then each person can eat <share> cucumbers

Examples:
| start | friends | share |
| 12 | 11 | 1 |
| 4 | 1 | 2 |
| 4 | 0 | 4 |
Loading

0 comments on commit d68f54e

Please sign in to comment.