max-scenarios-per-file
Limits how many scenarios one file may hold.
What it does#
A file with dozens of scenarios is hard to work with. This rule nudges you to split it into smaller files, each about one thing.
Turning it on#
Add this to your .gurkencheckrc:
{
"max-scenarios-per-file": ["on", {
"maxScenarios": 10,
"countOutlineExamples": true
}]
}
Settings#
| Setting | Value | If you leave it out | What it does |
|---|---|---|---|
maxScenarios |
number | 10 |
How many scenarios a single file may contain. |
countOutlineExamples |
true or false | true |
When true, every row of an Examples table counts as its own scenario, because that is how many times it will run. |
Examples#
Passes
Feature: Logging in
Scenario: A known user logs in
Given I am a known user
Scenario: An unknown user is turned away
Given I am not a known user
Fails
# The same file, but with 11 scenarios in it.
Feature: Everything about accounts
Scenario: Logging in
Given I am a known user
# ... nine more scenarios ...
Scenario: Deleting an account
Given I am a known user
gurkencheck reports: Number of scenarios exceeds maximum: 11/10