Closed mtkennerly closed 5 years ago
Will you cucumber runner fail for such steps ?
Yeah, it does. Here's the output from Behave:
$ behave
Feature: Demo # features/demo.feature:1
Scenario: A # features/demo.feature:2
When some multiword condition # None
You can implement step definitions for undefined steps with these snippets:
@when(u'some multiword condition')
def step_impl(context):
raise NotImplementedError(u'STEP: When some multiword condition')
Failing scenarios:
features/demo.feature:2 A
0 features passed, 1 failed, 0 skipped
0 scenarios passed, 1 failed, 0 skipped
0 steps passed, 0 failed, 0 skipped, 1 undefined
Took 0m0.000s
Changing When
to Given
in the feature file:
$ behave
Feature: Demo # features/demo.feature:1
Scenario: A # features/demo.feature:2
Given some multiword condition # steps/demo.py:4
1 feature passed, 0 failed, 0 skipped
1 scenario passed, 0 failed, 0 skipped
1 step passed, 0 failed, 0 skipped, 0 undefined
Took 0m0.000s
strictGherkinCompletion
option was designed for completion purpose only. Anyway, most runners will not fail in case of gherkin word mistmatch, so we can't add such checking in case for strictGherkinCompletion: true
.
As a variant, some alternative option like strictGherkinChecking
could be added in some future release.
Got it, that makes sense. I'm surprised that other runners wouldn't fail, but I just tried it in Ruby/Cucumber, and it passed.
strictGherkinValidation option added in 2.14.0 should correctly handle your case.
Describe the bug With strictGherkinCompletion turned on, step autocompletion correctly only shows matches with the same keyword. However, once you have fully typed the step, it is marked as valid and you can jump to its definition even though it has the wrong keyword.
To Reproduce Create these files:
steps/demo.py:
Open the feature file.
When some multiword condition
will not be flagged as invalid, and you can jump to the definition of thegiven
version.Expected behavior In this example,
When some multiword condition
should be flagged as invalid.Screenshots
Cucumberautocomplete part of VSCode settings:
Gherkin step line
When some multiword condition