Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Feature: Examples Tables - With Many Undefined Steps

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this case is needed at all. Example tables are sugar for repeating the same scenario, which is already covered by the undefined-multiple scenario.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a migration from something left out on the initial implementation

The replacement pattern used in scenario outlines does not influence how steps
are matched. The replacement pattern is replaced, and step definitions are
matched against that text. Because of that the following results in several
undefined steps for each example and suggested snippets to implement them.

Scenario Outline: Eating cucumbers
Given there are <start> cucumbers
When I eat <eat> cucumbers
Then I should have <left> cucumbers

@undefined
Examples: These are undefined because many of the values are not an {int}
| start | eat | left |
| pear | 1 | apple |
| pear | banana | 12 |
| 0 | banana | apple |
| pear | banana | apple |
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{"meta":{"protocolVersion":"31.1.0","implementation":{"name":"fake-cucumber","version":"123.45.6"},"cpu":{"name":"arm64"},"os":{"name":"darwin","version":"24.5.0"},"runtime":{"name":"Node.js","version":"24.4.1"},"ci":{"name":"GitHub Actions","url":"https://github.com/cucumber-ltd/shouty.rb/actions/runs/154666429","buildNumber":"154666429","git":{"revision":"99684bcacf01d95875834d87903dcb072306c9ad","remote":"https://github.com/cucumber-ltd/shouty.rb.git","branch":"main"}}}}
{"source":{"data":"Feature: Examples Tables - With Many Undefined Steps\n The replacement pattern used in scenario outlines does not influence how steps\n are matched. The replacement pattern is replaced, and step definitions are\n matched against that text. Because of that the following results in several\n undefined steps for each example and suggested snippets to implement them.\n\n Scenario Outline: Eating cucumbers\n Given there are <start> cucumbers\n When I eat <eat> cucumbers\n Then I should have <left> cucumbers\n\n @undefined\n Examples: These are undefined because many of the values are not an {int}\n | start | eat | left |\n | pear | 1 | apple |\n | pear | banana | 12 |\n | 0 | banana | apple |\n | pear | banana | apple |\n","uri":"samples/examples-tables-undefined-multiple/examples-tables-undefined-multiple.feature","mediaType":"text/x.cucumber.gherkin+plain"}}
{"gherkinDocument":{"feature":{"tags":[],"location":{"line":1,"column":1},"language":"en","keyword":"Feature","name":"Examples Tables - With Many Undefined Steps","description":" The replacement pattern used in scenario outlines does not influence how steps\n are matched. The replacement pattern is replaced, and step definitions are\n matched against that text. Because of that the following results in several\n undefined steps for each example and suggested snippets to implement them.","children":[{"scenario":{"id":"10","tags":[],"location":{"line":7,"column":3},"keyword":"Scenario Outline","name":"Eating cucumbers","description":"","steps":[{"id":"0","location":{"line":8,"column":5},"keyword":"Given ","keywordType":"Context","text":"there are <start> cucumbers"},{"id":"1","location":{"line":9,"column":5},"keyword":"When ","keywordType":"Action","text":"I eat <eat> cucumbers"},{"id":"2","location":{"line":10,"column":5},"keyword":"Then ","keywordType":"Outcome","text":"I should have <left> cucumbers"}],"examples":[{"id":"9","tags":[{"location":{"line":12,"column":5},"name":"@undefined","id":"8"}],"location":{"line":13,"column":5},"keyword":"Examples","name":"These are undefined because many of the values are not an {int}","description":"","tableHeader":{"id":"3","location":{"line":14,"column":7},"cells":[{"location":{"line":14,"column":9},"value":"start"},{"location":{"line":14,"column":17},"value":"eat"},{"location":{"line":14,"column":26},"value":"left"}]},"tableBody":[{"id":"4","location":{"line":15,"column":7},"cells":[{"location":{"line":15,"column":9},"value":"pear"},{"location":{"line":15,"column":17},"value":"1"},{"location":{"line":15,"column":26},"value":"apple"}]},{"id":"5","location":{"line":16,"column":7},"cells":[{"location":{"line":16,"column":9},"value":"pear"},{"location":{"line":16,"column":17},"value":"banana"},{"location":{"line":16,"column":26},"value":"12"}]},{"id":"6","location":{"line":17,"column":7},"cells":[{"location":{"line":17,"column":9},"value":"0"},{"location":{"line":17,"column":17},"value":"banana"},{"location":{"line":17,"column":26},"value":"apple"}]},{"id":"7","location":{"line":18,"column":7},"cells":[{"location":{"line":18,"column":9},"value":"pear"},{"location":{"line":18,"column":17},"value":"banana"},{"location":{"line":18,"column":26},"value":"apple"}]}]}]}}]},"comments":[],"uri":"samples/examples-tables-undefined-multiple/examples-tables-undefined-multiple.feature"}}
{"pickle":{"id":"14","uri":"samples/examples-tables-undefined-multiple/examples-tables-undefined-multiple.feature","location":{"line":15,"column":7},"astNodeIds":["10","4"],"name":"Eating cucumbers","language":"en","steps":[{"id":"11","text":"there are pear cucumbers","type":"Context","astNodeIds":["0","4"]},{"id":"12","text":"I eat 1 cucumbers","type":"Action","astNodeIds":["1","4"]},{"id":"13","text":"I should have apple cucumbers","type":"Outcome","astNodeIds":["2","4"]}],"tags":[{"name":"@undefined","astNodeId":"8"}]}}
{"pickle":{"id":"18","uri":"samples/examples-tables-undefined-multiple/examples-tables-undefined-multiple.feature","location":{"line":16,"column":7},"astNodeIds":["10","5"],"name":"Eating cucumbers","language":"en","steps":[{"id":"15","text":"there are pear cucumbers","type":"Context","astNodeIds":["0","5"]},{"id":"16","text":"I eat banana cucumbers","type":"Action","astNodeIds":["1","5"]},{"id":"17","text":"I should have 12 cucumbers","type":"Outcome","astNodeIds":["2","5"]}],"tags":[{"name":"@undefined","astNodeId":"8"}]}}
{"pickle":{"id":"22","uri":"samples/examples-tables-undefined-multiple/examples-tables-undefined-multiple.feature","location":{"line":17,"column":7},"astNodeIds":["10","6"],"name":"Eating cucumbers","language":"en","steps":[{"id":"19","text":"there are 0 cucumbers","type":"Context","astNodeIds":["0","6"]},{"id":"20","text":"I eat banana cucumbers","type":"Action","astNodeIds":["1","6"]},{"id":"21","text":"I should have apple cucumbers","type":"Outcome","astNodeIds":["2","6"]}],"tags":[{"name":"@undefined","astNodeId":"8"}]}}
{"pickle":{"id":"26","uri":"samples/examples-tables-undefined-multiple/examples-tables-undefined-multiple.feature","location":{"line":18,"column":7},"astNodeIds":["10","7"],"name":"Eating cucumbers","language":"en","steps":[{"id":"23","text":"there are pear cucumbers","type":"Context","astNodeIds":["0","7"]},{"id":"24","text":"I eat banana cucumbers","type":"Action","astNodeIds":["1","7"]},{"id":"25","text":"I should have apple cucumbers","type":"Outcome","astNodeIds":["2","7"]}],"tags":[{"name":"@undefined","astNodeId":"8"}]}}
{"stepDefinition":{"id":"27","pattern":{"type":"CUCUMBER_EXPRESSION","source":"there are {int} cucumbers"},"sourceReference":{"uri":"samples/examples-tables-undefined-multiple/examples-tables-undefined-multiple.ts","location":{"line":4}}}}
{"stepDefinition":{"id":"28","pattern":{"type":"CUCUMBER_EXPRESSION","source":"I eat {int} cucumbers"},"sourceReference":{"uri":"samples/examples-tables-undefined-multiple/examples-tables-undefined-multiple.ts","location":{"line":8}}}}
{"stepDefinition":{"id":"29","pattern":{"type":"CUCUMBER_EXPRESSION","source":"I should have {int} cucumbers"},"sourceReference":{"uri":"samples/examples-tables-undefined-multiple/examples-tables-undefined-multiple.ts","location":{"line":12}}}}
{"testRunStarted":{"id":"30","timestamp":{"seconds":0,"nanos":0}}}
{"testCase":{"id":"31","pickleId":"14","testSteps":[{"id":"32","pickleStepId":"11","stepDefinitionIds":[],"stepMatchArgumentsLists":[]},{"id":"33","pickleStepId":"12","stepDefinitionIds":["28"],"stepMatchArgumentsLists":[{"stepMatchArguments":[{"group":{"start":6,"value":"1"},"parameterTypeName":"int"}]}]},{"id":"34","pickleStepId":"13","stepDefinitionIds":[],"stepMatchArgumentsLists":[]}],"testRunStartedId":"30"}}
{"testCase":{"id":"35","pickleId":"18","testSteps":[{"id":"36","pickleStepId":"15","stepDefinitionIds":[],"stepMatchArgumentsLists":[]},{"id":"37","pickleStepId":"16","stepDefinitionIds":[],"stepMatchArgumentsLists":[]},{"id":"38","pickleStepId":"17","stepDefinitionIds":["29"],"stepMatchArgumentsLists":[{"stepMatchArguments":[{"group":{"start":14,"value":"12"},"parameterTypeName":"int"}]}]}],"testRunStartedId":"30"}}
{"testCase":{"id":"39","pickleId":"22","testSteps":[{"id":"40","pickleStepId":"19","stepDefinitionIds":["27"],"stepMatchArgumentsLists":[{"stepMatchArguments":[{"group":{"start":10,"value":"0"},"parameterTypeName":"int"}]}]},{"id":"41","pickleStepId":"20","stepDefinitionIds":[],"stepMatchArgumentsLists":[]},{"id":"42","pickleStepId":"21","stepDefinitionIds":[],"stepMatchArgumentsLists":[]}],"testRunStartedId":"30"}}
{"testCase":{"id":"43","pickleId":"26","testSteps":[{"id":"44","pickleStepId":"23","stepDefinitionIds":[],"stepMatchArgumentsLists":[]},{"id":"45","pickleStepId":"24","stepDefinitionIds":[],"stepMatchArgumentsLists":[]},{"id":"46","pickleStepId":"25","stepDefinitionIds":[],"stepMatchArgumentsLists":[]}],"testRunStartedId":"30"}}
{"testCaseStarted":{"id":"47","testCaseId":"31","timestamp":{"seconds":0,"nanos":1000000},"attempt":0}}
{"testStepStarted":{"testCaseStartedId":"47","testStepId":"32","timestamp":{"seconds":0,"nanos":2000000}}}
{"suggestion":{"id":"48","pickleStepId":"11","snippets":[{"language":"typescript","code":"Given(\"there are pear cucumbers\", () => {\n return \"pending\"\n})"}]}}
{"testStepFinished":{"testCaseStartedId":"47","testStepId":"32","testStepResult":{"status":"UNDEFINED","duration":{"seconds":0,"nanos":0}},"timestamp":{"seconds":0,"nanos":3000000}}}
{"testStepStarted":{"testCaseStartedId":"47","testStepId":"33","timestamp":{"seconds":0,"nanos":4000000}}}
{"testStepFinished":{"testCaseStartedId":"47","testStepId":"33","testStepResult":{"status":"SKIPPED","duration":{"seconds":0,"nanos":0}},"timestamp":{"seconds":0,"nanos":5000000}}}
{"testStepStarted":{"testCaseStartedId":"47","testStepId":"34","timestamp":{"seconds":0,"nanos":6000000}}}
{"suggestion":{"id":"49","pickleStepId":"13","snippets":[{"language":"typescript","code":"Then(\"I should have apple cucumbers\", () => {\n return \"pending\"\n})"}]}}
{"testStepFinished":{"testCaseStartedId":"47","testStepId":"34","testStepResult":{"status":"UNDEFINED","duration":{"seconds":0,"nanos":0}},"timestamp":{"seconds":0,"nanos":7000000}}}
{"testCaseFinished":{"testCaseStartedId":"47","timestamp":{"seconds":0,"nanos":8000000},"willBeRetried":false}}
{"testCaseStarted":{"id":"50","testCaseId":"35","timestamp":{"seconds":0,"nanos":9000000},"attempt":0}}
{"testStepStarted":{"testCaseStartedId":"50","testStepId":"36","timestamp":{"seconds":0,"nanos":10000000}}}
{"suggestion":{"id":"51","pickleStepId":"15","snippets":[{"language":"typescript","code":"Given(\"there are pear cucumbers\", () => {\n return \"pending\"\n})"}]}}
{"testStepFinished":{"testCaseStartedId":"50","testStepId":"36","testStepResult":{"status":"UNDEFINED","duration":{"seconds":0,"nanos":0}},"timestamp":{"seconds":0,"nanos":11000000}}}
{"testStepStarted":{"testCaseStartedId":"50","testStepId":"37","timestamp":{"seconds":0,"nanos":12000000}}}
{"suggestion":{"id":"52","pickleStepId":"16","snippets":[{"language":"typescript","code":"When(\"I eat banana cucumbers\", () => {\n return \"pending\"\n})"}]}}
{"testStepFinished":{"testCaseStartedId":"50","testStepId":"37","testStepResult":{"status":"UNDEFINED","duration":{"seconds":0,"nanos":0}},"timestamp":{"seconds":0,"nanos":13000000}}}
{"testStepStarted":{"testCaseStartedId":"50","testStepId":"38","timestamp":{"seconds":0,"nanos":14000000}}}
{"testStepFinished":{"testCaseStartedId":"50","testStepId":"38","testStepResult":{"status":"SKIPPED","duration":{"seconds":0,"nanos":0}},"timestamp":{"seconds":0,"nanos":15000000}}}
{"testCaseFinished":{"testCaseStartedId":"50","timestamp":{"seconds":0,"nanos":16000000},"willBeRetried":false}}
{"testCaseStarted":{"id":"53","testCaseId":"39","timestamp":{"seconds":0,"nanos":17000000},"attempt":0}}
{"testStepStarted":{"testCaseStartedId":"53","testStepId":"40","timestamp":{"seconds":0,"nanos":18000000}}}
{"testStepFinished":{"testCaseStartedId":"53","testStepId":"40","testStepResult":{"status":"PASSED","duration":{"seconds":0,"nanos":1000000}},"timestamp":{"seconds":0,"nanos":19000000}}}
{"testStepStarted":{"testCaseStartedId":"53","testStepId":"41","timestamp":{"seconds":0,"nanos":20000000}}}
{"suggestion":{"id":"54","pickleStepId":"20","snippets":[{"language":"typescript","code":"When(\"I eat banana cucumbers\", () => {\n return \"pending\"\n})"}]}}
{"testStepFinished":{"testCaseStartedId":"53","testStepId":"41","testStepResult":{"status":"UNDEFINED","duration":{"seconds":0,"nanos":0}},"timestamp":{"seconds":0,"nanos":21000000}}}
{"testStepStarted":{"testCaseStartedId":"53","testStepId":"42","timestamp":{"seconds":0,"nanos":22000000}}}
{"suggestion":{"id":"55","pickleStepId":"21","snippets":[{"language":"typescript","code":"Then(\"I should have apple cucumbers\", () => {\n return \"pending\"\n})"}]}}
{"testStepFinished":{"testCaseStartedId":"53","testStepId":"42","testStepResult":{"status":"UNDEFINED","duration":{"seconds":0,"nanos":0}},"timestamp":{"seconds":0,"nanos":23000000}}}
{"testCaseFinished":{"testCaseStartedId":"53","timestamp":{"seconds":0,"nanos":24000000},"willBeRetried":false}}
{"testCaseStarted":{"id":"56","testCaseId":"43","timestamp":{"seconds":0,"nanos":25000000},"attempt":0}}
{"testStepStarted":{"testCaseStartedId":"56","testStepId":"44","timestamp":{"seconds":0,"nanos":26000000}}}
{"suggestion":{"id":"57","pickleStepId":"23","snippets":[{"language":"typescript","code":"Given(\"there are pear cucumbers\", () => {\n return \"pending\"\n})"}]}}
{"testStepFinished":{"testCaseStartedId":"56","testStepId":"44","testStepResult":{"status":"UNDEFINED","duration":{"seconds":0,"nanos":0}},"timestamp":{"seconds":0,"nanos":27000000}}}
{"testStepStarted":{"testCaseStartedId":"56","testStepId":"45","timestamp":{"seconds":0,"nanos":28000000}}}
{"suggestion":{"id":"58","pickleStepId":"24","snippets":[{"language":"typescript","code":"When(\"I eat banana cucumbers\", () => {\n return \"pending\"\n})"}]}}
{"testStepFinished":{"testCaseStartedId":"56","testStepId":"45","testStepResult":{"status":"UNDEFINED","duration":{"seconds":0,"nanos":0}},"timestamp":{"seconds":0,"nanos":29000000}}}
{"testStepStarted":{"testCaseStartedId":"56","testStepId":"46","timestamp":{"seconds":0,"nanos":30000000}}}
{"suggestion":{"id":"59","pickleStepId":"25","snippets":[{"language":"typescript","code":"Then(\"I should have apple cucumbers\", () => {\n return \"pending\"\n})"}]}}
{"testStepFinished":{"testCaseStartedId":"56","testStepId":"46","testStepResult":{"status":"UNDEFINED","duration":{"seconds":0,"nanos":0}},"timestamp":{"seconds":0,"nanos":31000000}}}
{"testCaseFinished":{"testCaseStartedId":"56","timestamp":{"seconds":0,"nanos":32000000},"willBeRetried":false}}
{"testRunFinished":{"testRunStartedId":"30","timestamp":{"seconds":0,"nanos":33000000},"success":false}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import assert from 'node:assert'
import { Given, Then, When } from '@cucumber/fake-cucumber'

Given('there are {int} cucumbers', function (initialCount) {
this.count = initialCount
})

When('I eat {int} cucumbers', function (eatCount) {
this.count -= eatCount
})

Then('I should have {int} cucumbers', function (expectedCount) {
assert.strictEqual(this.count, expectedCount)
})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this rename needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly, but it was a bug which was picked up (or will be picked up), so figure in a breaking change (Which this will be), adding this is fine.

File renamed without changes.
Loading
Loading