chutney 3.6.0 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -2
- data/.rubocop.yml +4 -3
- data/Gemfile +9 -0
- data/README.md +49 -3
- data/chutney.gemspec +8 -17
- data/examples/emoji.feature +1 -2
- data/exe/chutney +28 -2
- data/exe/chutney-lsp +13 -0
- data/img/happy_chutney.png +0 -0
- data/lib/chutney/configuration.rb +31 -10
- data/lib/chutney/formatter/pie_formatter.rb +2 -2
- data/lib/chutney/linter/inconsistent_quoting.rb +1 -1
- data/lib/chutney/linter/invalid_file_name.rb +1 -1
- data/lib/chutney/linter/same_tag_different_case.rb +1 -1
- data/lib/chutney/linter/same_tag_for_all_scenarios.rb +2 -2
- data/lib/chutney/linter/unique_scenario_names.rb +1 -1
- data/lib/chutney/linter/unused_variable.rb +1 -1
- data/lib/chutney/linter/use_outline.rb +1 -1
- data/lib/chutney/linter.rb +1 -1
- data/lib/chutney/lsp/result.rb +16 -0
- data/lib/chutney/lsp/server.rb +177 -0
- data/lib/chutney/lsp.rb +7 -0
- data/lib/chutney/version.rb +1 -1
- data/lib/chutney.rb +8 -3
- data/usechutney.com/.gitignore +5 -0
- data/usechutney.com/Gemfile +37 -0
- data/usechutney.com/_config.yml +298 -0
- data/usechutney.com/_data/navigation.yml +112 -0
- data/usechutney.com/_data/ui-text.yml +2132 -0
- data/usechutney.com/_posts/2024-09-23-welcome-to-jekyll.markdown +28 -0
- data/usechutney.com/assets/images/mr_pickle.png +0 -0
- data/usechutney.com/assets/images/pug.png +0 -0
- data/usechutney.com/docs/configuration/index.md +104 -0
- data/usechutney.com/docs/disabling-rules/index.md +11 -0
- data/usechutney.com/docs/installing/index.md +30 -0
- data/usechutney.com/docs/language-server/index.md +24 -0
- data/usechutney.com/docs/rules/avoid-full-stops/index.md +23 -0
- data/usechutney.com/docs/rules/avoid-outline-for-single-example/index.md +28 -0
- data/usechutney.com/docs/rules/avoid-scripting/index.md +33 -0
- data/usechutney.com/docs/rules/avoid-splat-steps-in-background/index.md +25 -0
- data/usechutney.com/docs/rules/avoid-splat-steps-in-scenarios/index.md +29 -0
- data/usechutney.com/docs/rules/avoid-typographers-quotes/index.md +24 -0
- data/usechutney.com/docs/rules/background-does-more-than-setup/index.md +28 -0
- data/usechutney.com/docs/rules/background-requires-multiple-scenarios/index.md +26 -0
- data/usechutney.com/docs/rules/bad-scenario-name/index.md +28 -0
- data/usechutney.com/docs/rules/empty-feature-file/index.md +7 -0
- data/usechutney.com/docs/rules/file-name-differs-feature-name/index.md +37 -0
- data/usechutney.com/docs/rules/givens-after-background/index.md +36 -0
- data/usechutney.com/docs/rules/inconsistent-quoting/index.md +29 -0
- data/usechutney.com/docs/rules/invalid-step-flow/index.md +31 -0
- data/usechutney.com/docs/rules/invalid_file_name/index.md +19 -0
- data/usechutney.com/docs/rules/missing-example-name/index.md +49 -0
- data/usechutney.com/docs/rules/missing-example-table/index.md +34 -0
- data/usechutney.com/docs/rules/missing-feature-description/index.md +25 -0
- data/usechutney.com/docs/rules/missing-feature-name/index.md +19 -0
- data/usechutney.com/docs/rules/missing-scenario-name/index.md +19 -0
- data/usechutney.com/docs/rules/missing-scenario-outline/index.md +39 -0
- data/usechutney.com/docs/rules/missing-test-action/index.md +28 -0
- data/usechutney.com/docs/rules/missing-test-verification/index.md +28 -0
- data/usechutney.com/docs/rules/required-tag-starts-with/index.md +31 -0
- data/usechutney.com/docs/rules/same-tag-different-case/index.md +42 -0
- data/usechutney.com/docs/rules/same-tag-for-all-scenarios/index.md +42 -0
- data/usechutney.com/docs/rules/scenario-names-match/index.md +30 -0
- data/usechutney.com/docs/rules/tag-used-multiple-times/index.md +32 -0
- data/usechutney.com/docs/rules/too-clumsy/index.md +78 -0
- data/usechutney.com/docs/rules/too-long-step/index.md +30 -0
- data/usechutney.com/docs/rules/too-many-different-tags/index.md +32 -0
- data/usechutney.com/docs/rules/too-many-steps/index.md +79 -0
- data/usechutney.com/docs/rules/too-many-tags/index.md +32 -0
- data/usechutney.com/docs/rules/unique-scenario-names/index.md +39 -0
- data/usechutney.com/docs/rules/unknown-variable/index.md +38 -0
- data/usechutney.com/docs/rules/unused-variable/index.md +37 -0
- data/usechutney.com/docs/rules/use-background/index.md +40 -0
- data/usechutney.com/docs/rules/use-outline/index.md +39 -0
- data/usechutney.com/docs/running/index.md +33 -0
- data/usechutney.com/pages/404.html +25 -0
- data/usechutney.com/pages/about/index.md +14 -0
- data/usechutney.com/pages/index.markdown +40 -0
- metadata +76 -114
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
title: "Welcome to Jekyll!"
|
3
|
+
date: 2024-09-23 20:31:37 +0100
|
4
|
+
categories: jekyll update
|
5
|
+
---
|
6
|
+
You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.
|
7
|
+
|
8
|
+
Jekyll requires blog post files to be named according to the following format:
|
9
|
+
|
10
|
+
`YEAR-MONTH-DAY-title.MARKUP`
|
11
|
+
|
12
|
+
Where `YEAR` is a four-digit number, `MONTH` and `DAY` are both two-digit numbers, and `MARKUP` is the file extension representing the format used in the file. After that, include the necessary front matter. Take a look at the source for this post to get an idea about how it works.
|
13
|
+
|
14
|
+
Jekyll also offers powerful support for code snippets:
|
15
|
+
|
16
|
+
{% highlight ruby %}
|
17
|
+
def print_hi(name)
|
18
|
+
puts "Hi, #{name}"
|
19
|
+
end
|
20
|
+
print_hi('Tom')
|
21
|
+
#=> prints 'Hi, Tom' to STDOUT.
|
22
|
+
{% endhighlight %}
|
23
|
+
|
24
|
+
Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll Talk][jekyll-talk].
|
25
|
+
|
26
|
+
[jekyll-docs]: https://jekyllrb.com/docs/home
|
27
|
+
[jekyll-gh]: https://github.com/jekyll/jekyll
|
28
|
+
[jekyll-talk]: https://talk.jekyllrb.com/
|
Binary file
|
Binary file
|
@@ -0,0 +1,104 @@
|
|
1
|
+
---
|
2
|
+
title: "Configuring Chutney"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/configuration/
|
5
|
+
---
|
6
|
+
|
7
|
+
Chutney has a default configuration which may or may not suit your needs. It's rules are defined in a simple YAML configuration file that you can customise.
|
8
|
+
|
9
|
+
## Configuration file
|
10
|
+
|
11
|
+
You can name your configuration file `chutney.yml` or `.chutney.yml`. The first style is preferred because it is not hidden by default in most file systems.
|
12
|
+
|
13
|
+
The file can be placed in the root of your project, or in a subdirectory called `/config`.
|
14
|
+
|
15
|
+
Chutney will create a default configuration file for you, `chutney.yml`, in your current directory if you run:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
chutney --init
|
19
|
+
```
|
20
|
+
|
21
|
+
It will look something like this, but don't worry, it looks more complicated than it is:
|
22
|
+
|
23
|
+
```yaml
|
24
|
+
AvoidOutlineForSingleExample:
|
25
|
+
Enabled: true
|
26
|
+
AvoidFullStop:
|
27
|
+
Enabled: true
|
28
|
+
AvoidScripting:
|
29
|
+
Enabled: true
|
30
|
+
AvoidSplatStepsInBackground:
|
31
|
+
Enabled: true
|
32
|
+
AvoidSplatStepsInScenarios:
|
33
|
+
Enabled: true
|
34
|
+
AvoidTypographersQuotes:
|
35
|
+
Enabled: true
|
36
|
+
BackgroundDoesMoreThanSetup:
|
37
|
+
Enabled: true
|
38
|
+
BackgroundRequiresMultipleScenarios:
|
39
|
+
Enabled: true
|
40
|
+
BadScenarioName:
|
41
|
+
Enabled: true
|
42
|
+
EmptyFeatureFile:
|
43
|
+
Enabled: true
|
44
|
+
FileNameDiffersFeatureName:
|
45
|
+
Enabled: true
|
46
|
+
GivensAfterBackground:
|
47
|
+
Enabled: true
|
48
|
+
MissingExampleName:
|
49
|
+
Enabled: true
|
50
|
+
MissingExampleTable:
|
51
|
+
Enabled: true
|
52
|
+
MissingFeatureDescription:
|
53
|
+
Enabled: true
|
54
|
+
MissingFeatureName:
|
55
|
+
Enabled: true
|
56
|
+
MissingScenarioName:
|
57
|
+
Enabled: true
|
58
|
+
MissingScenarioOutline:
|
59
|
+
Enabled: true
|
60
|
+
MissingTestAction:
|
61
|
+
Enabled: true
|
62
|
+
MissingVerification:
|
63
|
+
Enabled: true
|
64
|
+
InconsistentQuoting:
|
65
|
+
Enabled: true
|
66
|
+
InvalidFileName:
|
67
|
+
Enabled: true
|
68
|
+
InvalidStepFlow:
|
69
|
+
Enabled: true
|
70
|
+
RequiredTagsStartsWith:
|
71
|
+
Enabled: false
|
72
|
+
SameTagDifferentCase:
|
73
|
+
Enabled: true
|
74
|
+
SameTagForAllScenarios:
|
75
|
+
Enabled: true
|
76
|
+
ScenarioNamesMatch:
|
77
|
+
Enabled: false
|
78
|
+
TagUsedMultipleTimes:
|
79
|
+
Enabled: true
|
80
|
+
TooClumsy:
|
81
|
+
Enabled: true
|
82
|
+
TooManyDifferentTags:
|
83
|
+
Enabled: true
|
84
|
+
MaxCount: 3
|
85
|
+
TooManySteps:
|
86
|
+
Enabled: true
|
87
|
+
MaxCount: 10
|
88
|
+
TooManyTags:
|
89
|
+
Enabled: true
|
90
|
+
MaxCount: 3
|
91
|
+
TooLongStep:
|
92
|
+
Enabled: true
|
93
|
+
MaxLength: 80
|
94
|
+
UniqueScenarioNames:
|
95
|
+
Enabled: true
|
96
|
+
UnknownVariable:
|
97
|
+
Enabled: true
|
98
|
+
UnusedVariable:
|
99
|
+
Enabled: true
|
100
|
+
UseBackground:
|
101
|
+
Enabled: true
|
102
|
+
UseOutline:
|
103
|
+
Enabled: true
|
104
|
+
```
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
title: "Disabling Rules"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/disabling-rules/
|
5
|
+
---
|
6
|
+
|
7
|
+
With all the best will and good intentions in the world, sometimes you need to break a rule. You might need to do this for a very good reason or because the rule is mis-identifing something that you think is valid.
|
8
|
+
|
9
|
+
To do this, use the tag format `@disable<Linter Name>`. For example `@disableTooLongStep`.
|
10
|
+
|
11
|
+
If used at the feature level, the linter will be deactivated for the whole file, used at the scenario level, only that one scenario will be excused.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
title: "Installing Chutney"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/installing/
|
5
|
+
---
|
6
|
+
|
7
|
+
Chutney is written in Ruby and distributed as a Ruby gem. This means you need to have Ruby installed on your system to use Chutney.
|
8
|
+
|
9
|
+
## Installing Ruby
|
10
|
+
|
11
|
+
To install Ruby, follow the instructions on the [Ruby website](https://www.ruby-lang.org/en/documentation/installation/).
|
12
|
+
|
13
|
+
## Installing Chutney
|
14
|
+
|
15
|
+
Once you have Ruby installed, you can install Chutney system-wide by running the following command:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
gem install chutney
|
19
|
+
```
|
20
|
+
and update it with:
|
21
|
+
|
22
|
+
```bash
|
23
|
+
gem update chutney
|
24
|
+
```
|
25
|
+
or you can install Chutney locally by adding it to your Gemfile (you should do this if you have a Ruby-Cucumber test pack):
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
gem 'chutney', "~> <latest version number>"
|
29
|
+
```
|
30
|
+
(you can grab the latest version number from the [RubyGems page](https://rubygems.org/gems/chutney).)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
title: "Chutney Language Server"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/language-server/
|
5
|
+
---
|
6
|
+
|
7
|
+
{: .notice}
|
8
|
+
Since v3.8.0
|
9
|
+
|
10
|
+
Chutney now includes a Language Server (LSP), which can be used with your favourite editor to provide real-time feedback on your feature files.
|
11
|
+
|
12
|
+
The command to start the Language Server is:
|
13
|
+
|
14
|
+
```bash
|
15
|
+
chutney-lsp
|
16
|
+
```
|
17
|
+
|
18
|
+
The language server will consume from the standard input and emit to standard output. This means that you can use it with any editor that supports the LSP protocol.
|
19
|
+
|
20
|
+
It will listen for open / close and save events to evaluate the current feature file and provide feedback.
|
21
|
+
|
22
|
+
## Editor integrations
|
23
|
+
|
24
|
+
TBD.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
title: "Avoid Full Stops"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/rules/avoid-full-stops/
|
5
|
+
---
|
6
|
+
|
7
|
+
Don't include a full stop (a period) in your steps because it makes reuse a lot harder, espcially if that step suddenly appears in the middle of a scenario.
|
8
|
+
|
9
|
+
## Bad
|
10
|
+
|
11
|
+
```gherkin
|
12
|
+
Given I have visited the website
|
13
|
+
When I log in.
|
14
|
+
Then I will see my account
|
15
|
+
```
|
16
|
+
|
17
|
+
## Good
|
18
|
+
|
19
|
+
```gherkin
|
20
|
+
Given I have visited the website
|
21
|
+
When I log in
|
22
|
+
Then I will see my account
|
23
|
+
```
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
title: "Avoid Outline for Single Example"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/rules/avoid-outline-for-single-example/
|
5
|
+
---
|
6
|
+
|
7
|
+
If you have a Scenario Outline, but only one example, then you should convert it to a Scenario because it reduces the complexity of the feature file.
|
8
|
+
|
9
|
+
## Bad
|
10
|
+
|
11
|
+
```gherkin
|
12
|
+
Scenario Outline: Log in with valid credentials
|
13
|
+
Given I have visited the website
|
14
|
+
When I log in with <username> and <password>
|
15
|
+
Then I will see my account
|
16
|
+
Examples: of valid credentials
|
17
|
+
| username | password |
|
18
|
+
| user1 | pass1 |
|
19
|
+
```
|
20
|
+
|
21
|
+
## Good
|
22
|
+
|
23
|
+
```gherkin
|
24
|
+
Scenario: Log in with valid credentials
|
25
|
+
Given I have visited the website
|
26
|
+
When I log in with "user1" and "pass1"
|
27
|
+
Then I will see my account
|
28
|
+
```
|
@@ -0,0 +1,33 @@
|
|
1
|
+
---
|
2
|
+
title: "Avoid Scripting"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/rules/avoid-scripting/
|
5
|
+
---
|
6
|
+
|
7
|
+
If you find yourself needing to write more than one `when` step, you a probably scripting. This is a bad practice because it makes your tests harder to read and maintain. It also makes it harder to debug when something goes wrong.
|
8
|
+
|
9
|
+
It is much better to describe what outcome should happen in your steps and let the automation code handle the implementation details. This makes your tests more readable and easier to maintain.
|
10
|
+
|
11
|
+
## Bad
|
12
|
+
|
13
|
+
```gherkin
|
14
|
+
Scenario: Log in with valid credentials
|
15
|
+
Given I have visited the website
|
16
|
+
When I click the log in button
|
17
|
+
And I enter "user1" in the username field
|
18
|
+
And I enter "pass1" in the password field
|
19
|
+
And I click the submit button
|
20
|
+
Then I will see my account page
|
21
|
+
And I will see my username
|
22
|
+
And I will see my profile picture
|
23
|
+
And I will see my account balance
|
24
|
+
```
|
25
|
+
|
26
|
+
## Good
|
27
|
+
|
28
|
+
```gherkin
|
29
|
+
Scenario: Log in with valid credentials
|
30
|
+
Given I have visited the website
|
31
|
+
When I log in with "user1" and "pass1"
|
32
|
+
Then I will see my account
|
33
|
+
```
|
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
title: "Avoid Splat Steps in Background"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/rules/avoid-splat-steps-in-background/
|
5
|
+
---
|
6
|
+
|
7
|
+
Splat steps (using an asterisk `*`) can obscure the what kind of step is present and make it less like reading natural language.
|
8
|
+
|
9
|
+
## Bad
|
10
|
+
|
11
|
+
```gherkin
|
12
|
+
Background:
|
13
|
+
Given I have visited the website
|
14
|
+
* I have logged in
|
15
|
+
* I have viewed sale items
|
16
|
+
```
|
17
|
+
|
18
|
+
## Good
|
19
|
+
|
20
|
+
```gherkin
|
21
|
+
Background:
|
22
|
+
Given I have visited the website
|
23
|
+
And I have logged in
|
24
|
+
And I have viewed sale items
|
25
|
+
```
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
title: "Avoid Splat Steps in Scenarios"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/rules/avoid-splat-steps-in-scenarios/
|
5
|
+
---
|
6
|
+
|
7
|
+
Splat steps (using an asterisk `*`) can obscure the what kind of step is present and make it less like reading natural language.
|
8
|
+
|
9
|
+
## Bad
|
10
|
+
|
11
|
+
```gherkin
|
12
|
+
Scenario: Log in with valid credentials
|
13
|
+
Given I have visited the website
|
14
|
+
* I have logged in
|
15
|
+
* I have viewed sale items
|
16
|
+
When I view special offers
|
17
|
+
Then I will see my discount code
|
18
|
+
```
|
19
|
+
|
20
|
+
## Good
|
21
|
+
|
22
|
+
```gherkin
|
23
|
+
Scenario: Log in with valid credentials
|
24
|
+
Given I have visited the website
|
25
|
+
And I have logged in
|
26
|
+
And I have viewed sale items
|
27
|
+
When I view special offers
|
28
|
+
Then I will see my discount code
|
29
|
+
```
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
title: "Avoid Typographers' Quotes"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/rules/avoid-typographers-quotes/
|
5
|
+
---
|
6
|
+
|
7
|
+
Cutting and pasting from Word documents? Is that pasting in curly-quotes instead of neutral ones you would type on a keyboard? Are you sure that’s what you want?
|
8
|
+
|
9
|
+
Typographers' quotes are hard to differentiate from neutral ones in text editors but they are not the same characters and this can make it very hard to maintain feature files and their backing steps. Take a look at the 'bad' example: it's not at all obvious at first sight.
|
10
|
+
|
11
|
+
## Bad
|
12
|
+
|
13
|
+
```gherkin
|
14
|
+
Scenario: Log in with valid credentials
|
15
|
+
When I visit the website
|
16
|
+
Then I will see the message “account information”
|
17
|
+
```
|
18
|
+
|
19
|
+
## Good
|
20
|
+
```gherkin
|
21
|
+
Scenario: Log in with valid credentials
|
22
|
+
When I visit the website
|
23
|
+
Then I will see the message "account information"
|
24
|
+
```
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
title: "Background Does More Than Setup"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/rules/background-does-more-than-setup/
|
5
|
+
---
|
6
|
+
|
7
|
+
The `Background` should only perform common setup activities to prepare the scenarios that follow. They should not contain any `When` or `Then` steps, only `Given`.
|
8
|
+
|
9
|
+
## Bad
|
10
|
+
|
11
|
+
```gherkin
|
12
|
+
Background:
|
13
|
+
Given I have visited the website
|
14
|
+
When I log in
|
15
|
+
|
16
|
+
Scenario: logging in
|
17
|
+
Then I will see my account
|
18
|
+
```
|
19
|
+
|
20
|
+
## Good
|
21
|
+
```gherkin
|
22
|
+
Background:
|
23
|
+
Given I have visited the website
|
24
|
+
|
25
|
+
Scenario: logging in
|
26
|
+
When I log in
|
27
|
+
Then I will see my account
|
28
|
+
```
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
title: "Background Requires Multiple Scenarios"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/rules/background-requires-multiple-scenarios/
|
5
|
+
---
|
6
|
+
|
7
|
+
If you only have one scenario, you don't need a `Background`. The `Background` should only be used when you have multiple scenarios that share the same setup steps.
|
8
|
+
|
9
|
+
## Bad
|
10
|
+
|
11
|
+
```gherkin
|
12
|
+
Background:
|
13
|
+
Given I have visited the website
|
14
|
+
|
15
|
+
Scenario: logging in
|
16
|
+
When I log in
|
17
|
+
Then I will see my account
|
18
|
+
```
|
19
|
+
|
20
|
+
## Good
|
21
|
+
```gherkin
|
22
|
+
Scenario: logging in
|
23
|
+
Given I have visited the website
|
24
|
+
When I log in
|
25
|
+
Then I will see my account
|
26
|
+
```
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
title: "Bad Scenario Name"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/rules/bad-scenario-name/
|
5
|
+
---
|
6
|
+
|
7
|
+
{: .notice}
|
8
|
+
English language only.
|
9
|
+
|
10
|
+
The name of a scenario should avoid words like 'test' and 'check'. The name should be a description of the scenario, not a statement of what it does.
|
11
|
+
|
12
|
+
## Bad
|
13
|
+
|
14
|
+
```gherkin
|
15
|
+
|
16
|
+
Scenario: checking the login
|
17
|
+
Given I have visited the website
|
18
|
+
When I log in
|
19
|
+
Then I will see my account
|
20
|
+
```
|
21
|
+
|
22
|
+
## Good
|
23
|
+
```gherkin
|
24
|
+
Scenario: logging in
|
25
|
+
Given I have visited the website
|
26
|
+
When I log in
|
27
|
+
Then I will see my account
|
28
|
+
```
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
title: "File Name Differs From Feature Name"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/rules/file-name-differs-feature-name/
|
5
|
+
---
|
6
|
+
|
7
|
+
The name of a feature file should match the name of the feature it describes. This makes it easier to find the feature file that contains a specific scenario.
|
8
|
+
|
9
|
+
Case and punctuation can vary between the feature name and the file name, but the words should match.
|
10
|
+
|
11
|
+
## Bad
|
12
|
+
|
13
|
+
{: .notice}
|
14
|
+
`user.feature`
|
15
|
+
|
16
|
+
```gherkin
|
17
|
+
Feature: logging in
|
18
|
+
|
19
|
+
Scenario: logging in
|
20
|
+
Given I have visited the website
|
21
|
+
When I log in
|
22
|
+
Then I will see my account
|
23
|
+
```
|
24
|
+
|
25
|
+
## Good
|
26
|
+
|
27
|
+
{: .notice}
|
28
|
+
`logging-in.feature`
|
29
|
+
|
30
|
+
```gherkin
|
31
|
+
Feature: logging in
|
32
|
+
|
33
|
+
Scenario: logging in
|
34
|
+
Given I have visited the website
|
35
|
+
When I log in
|
36
|
+
Then I will see my account
|
37
|
+
```
|
@@ -0,0 +1,36 @@
|
|
1
|
+
---
|
2
|
+
title: "Givens After Background"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/rules/givens-after-background/
|
5
|
+
---
|
6
|
+
|
7
|
+
If you have a `Background` section in a feaure file and your scenarios still need to do some setup, you should start immediately with an `And` step. This makes it clear that the setup is in addition to the background and makes it obvious that the scenario is not sufficient on its own.
|
8
|
+
|
9
|
+
This is important when reading a scenario as it reminds the reader that the scenario is not self-contained.
|
10
|
+
|
11
|
+
## Bad
|
12
|
+
|
13
|
+
```gherkin
|
14
|
+
Feature: logging in
|
15
|
+
|
16
|
+
Background:
|
17
|
+
Given I have visited the website
|
18
|
+
|
19
|
+
Scenario: logging in
|
20
|
+
Given I have logged in
|
21
|
+
When I view my profile
|
22
|
+
Then I will see my account
|
23
|
+
```
|
24
|
+
|
25
|
+
## Good
|
26
|
+
|
27
|
+
```gherkin
|
28
|
+
|
29
|
+
Background:
|
30
|
+
Given I have visited the website
|
31
|
+
|
32
|
+
Scenario: logging in
|
33
|
+
And I have logged in
|
34
|
+
When I view my profile
|
35
|
+
Then I will see my account
|
36
|
+
```
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
title: "Inconsistent Quoting"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/rules/inconsistent-quoting/
|
5
|
+
---
|
6
|
+
|
7
|
+
Use either single or double quotes consistently throughout your feature files. This makes it clear to the reader where your strings and variables are.
|
8
|
+
|
9
|
+
## Bad
|
10
|
+
|
11
|
+
```gherkin
|
12
|
+
Feature: logging in
|
13
|
+
|
14
|
+
Scenario: logging in
|
15
|
+
Given I have visited the website
|
16
|
+
When I log in with "username" and 'password'
|
17
|
+
Then I will see my account
|
18
|
+
```
|
19
|
+
|
20
|
+
## Good
|
21
|
+
|
22
|
+
```gherkin
|
23
|
+
Feature: logging in
|
24
|
+
|
25
|
+
Scenario: logging in
|
26
|
+
Given I have visited the website
|
27
|
+
When I log in with "username" and "password"
|
28
|
+
Then I will see my account
|
29
|
+
```
|
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
title: "Invalid Step Flow"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/rules/invalid-step-flow/
|
5
|
+
---
|
6
|
+
|
7
|
+
Scenarios should follow the Given-When-Then structure. This makes it clear to the reader what the scenario is doing and what the expected outcome is.
|
8
|
+
|
9
|
+
You should not have `Then` steps before `When` steps, or `When` steps before `Given` steps, and you should not have `Given` steps after `When` steps.
|
10
|
+
|
11
|
+
## Bad
|
12
|
+
|
13
|
+
```gherkin
|
14
|
+
Feature: logging in
|
15
|
+
|
16
|
+
Scenario: logging in
|
17
|
+
Given I have visited the website
|
18
|
+
Then I log in with "username" and 'password'
|
19
|
+
When I will see my account
|
20
|
+
```
|
21
|
+
|
22
|
+
## Good
|
23
|
+
|
24
|
+
```gherkin
|
25
|
+
Feature: logging in
|
26
|
+
|
27
|
+
Scenario: logging in
|
28
|
+
Given I have visited the website
|
29
|
+
When I log in with "username" and "password"
|
30
|
+
Then I will see my account
|
31
|
+
```
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
title: "Invalid File Name"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/rules/invalid-file-name/
|
5
|
+
---
|
6
|
+
|
7
|
+
The name of the feature file should be in `snake_case` and end with `.feature`. It should not be in `mixedCase` or contain spaces. This makes sure that the feature file can easily be found on different types of operating system which have different file naming conventions.
|
8
|
+
|
9
|
+
## Bad
|
10
|
+
|
11
|
+
{: .notice}
|
12
|
+
`Logging In.feature`
|
13
|
+
<br/>
|
14
|
+
`logginIn.feature`
|
15
|
+
|
16
|
+
## Good
|
17
|
+
|
18
|
+
{: .notice}
|
19
|
+
`logging_in.feature`
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
title: "Missing Example Name"
|
3
|
+
layout: single
|
4
|
+
permalink: /docs/rules/missing-example-name/
|
5
|
+
---
|
6
|
+
|
7
|
+
If you have more than one example table in a scenario, you should give each example a name. This makes it easier to understand what each example is testing.
|
8
|
+
|
9
|
+
## Bad
|
10
|
+
|
11
|
+
```gherkin
|
12
|
+
Feature: logging in
|
13
|
+
|
14
|
+
Scenario: logging in
|
15
|
+
Given I have visited the website
|
16
|
+
When I log in with "username" and "password"
|
17
|
+
Then I will see my account
|
18
|
+
|
19
|
+
Examples:
|
20
|
+
| username | password |
|
21
|
+
| user1 | pass1 |
|
22
|
+
| user2 | pass2 |
|
23
|
+
|
24
|
+
Examples:
|
25
|
+
| username | password |
|
26
|
+
| admin1 | pass1 |
|
27
|
+
| admin2 | pass2 |
|
28
|
+
```
|
29
|
+
|
30
|
+
## Bad
|
31
|
+
|
32
|
+
```gherkin
|
33
|
+
Feature: logging in
|
34
|
+
|
35
|
+
Scenario: logging in
|
36
|
+
Given I have visited the website
|
37
|
+
When I log in with "username" and "password"
|
38
|
+
Then I will see my account
|
39
|
+
|
40
|
+
Examples: of regular users
|
41
|
+
| username | password |
|
42
|
+
| user1 | pass1 |
|
43
|
+
| user2 | pass2 |
|
44
|
+
|
45
|
+
Examples: of admin users
|
46
|
+
| username | password |
|
47
|
+
| admin1 | pass1 |
|
48
|
+
| admin2 | pass2 |
|
49
|
+
```
|