no-scenarios-without-then
Every scenario has to check something.
What it does#
A scenario with no Then step acts without ever saying what should have happened, so it passes for as long as nothing throws - which is not the same as the feature working. Steps in a Background count towards this, because they really do run before the scenario; turn countBackground off if you want every scenario to read on its own instead. An And or a But counts as whatever keyword it carries on from.
Turning it on#
Add this to your .gurkencheckrc:
{
"no-scenarios-without-then": ["on", {"countBackground": true}]
}
Settings#
| Setting | Value | If you leave it out | What it does |
|---|---|---|---|
countBackground |
true or false | true |
Whether a Then step in a Background counts for the scenarios under it. Set it to false to make each scenario stand on its own. |
Examples#
Passes
Feature: Logging in
Scenario: A known user logs in
Given I am a known user
When I log in
Then I see my dashboard
Fails
Feature: Logging in
Scenario: A known user logs in
Given I am a known user
When I log in
gurkencheck reports: Scenario "A known user logs in" does not have a Then step