Highlight undefined steps in Scenario Outlines
kiran-epic opened this issue · 10 comments
When using scenario outline for data-driving with the help of examples, The following issues occur :
-
Only the parameters which are present in the Examples table are highlighted. For example in the below image, the "EducatorLogin" & "Dashboard" parameters are not highlighted as it's mentioned directly in the step as they don't change so no need to put it in the Examples table
-
The missing step highlighter/generator doesn't run if there is an example table in the scenario. For example in the below image, the step
Given QWERTY
is invalid, but it's not highlighted & pressing Cmd+. doesn't give to generate a step definition for it.
But if the example table is removed, it starts highlighting the step & also suggests action to generate step definition
This is actually by design.
Highlighting of parameters is done by matching steps against step definitions. For steps in regular scenarios we can do this. For steps in scenario outlines it is tricky to do, because each outline step becomes multiple steps after the <>
is substituted.
Consider this example:
Scenario Outline:
Given I have <count> cukes in my <container>
Examples:
| count | container |
| 4 | basket |
| 7 | bag |
This becomes two scenarios, each with the following step:
Given I have 4 cukes in my basket
Given I have 7 cukes in my bag
Now, imagine we have two step definitions with the following expressions:
I have 4 cukes in my {word}
I have {int} cukes in my bag
The first step would match the first expression, and the second step would match the second expression. Each match has only a single parameter.
How should we highlight in this case?
I suppose a compromise could be to highlight using matches if there are no <>
placeholders, and highlight the <>
placeholders otherwise.
@kiran-epic any feedback on my proposal?
@aslakhellesoy That sounds good to me!
@aslakhellesoy Would you also fix the bug where the autocomplete & missing step highlighter stops working when using Examples ?
I haven’t offered to fix anything, just discussing a potential solution.
This project relies on contributions from our community.
Hi! I have the same problems as @kiran-epic working with scenario outlines, can somebody suggest a temporal solution until this bug will be fixed? Mainly for the most important problem the missing step highlighter/generator doesn't run working with scenarios outlines
Thank you!
Captured a feature request for this support in the Cucumber Language Service - where the changes would be required - with some possible considerations and options (cucumber/language-service#149). If you have any feedback, that would be great - to help define the necessary changes to see this implemented.
Same problem for me, but even with Scenario : not only Scenario Outline.
A workaround is to comment the Examples table, but latest version 1.8.0 removes the comments on save !!!
It would be great to generate at least the first Step definition to remove the highlighting when Outline.
Examples seems to be the problem to me and must be ignored by the extension for syntax highlighting...
The emergency problem is to be able to keep comments on save.
@Alphapage, deletion of trailing comments is resolved by cucumber/gherkin-utils#38 and will be available following a gherkin-utils release of merged changes and thereafter of a Visual Studio Code extension release.
Sorry, I read it was fixed in v.1.8.0 somewhere or I misunderstood something...
Thank you anyway for the clarification and I hope the extension will be updated soon +1