cuke_linter 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +217 -211
- data/LICENSE.txt +21 -21
- data/README.md +160 -160
- data/cuke_linter.gemspec +59 -58
- data/exe/cuke_linter +112 -112
- data/lib/cuke_linter/configuration.rb +45 -45
- data/lib/cuke_linter/default_linters.rb +32 -32
- data/lib/cuke_linter/formatters/pretty_formatter.rb +84 -84
- data/lib/cuke_linter/gherkin.rb +10 -10
- data/lib/cuke_linter/linter_registration.rb +32 -32
- data/lib/cuke_linter/linters/background_does_more_than_setup_linter.rb +35 -35
- data/lib/cuke_linter/linters/element_with_common_tags_linter.rb +49 -49
- data/lib/cuke_linter/linters/element_with_duplicate_tags_linter.rb +48 -48
- data/lib/cuke_linter/linters/element_with_too_many_tags_linter.rb +46 -46
- data/lib/cuke_linter/linters/example_without_name_linter.rb +19 -19
- data/lib/cuke_linter/linters/feature_file_with_invalid_name_linter.rb +20 -20
- data/lib/cuke_linter/linters/feature_file_with_mismatched_name_linter.rb +25 -25
- data/lib/cuke_linter/linters/feature_with_too_many_different_tags_linter.rb +35 -35
- data/lib/cuke_linter/linters/feature_without_description_linter.rb +19 -19
- data/lib/cuke_linter/linters/feature_without_name_linter.rb +19 -19
- data/lib/cuke_linter/linters/feature_without_scenarios_linter.rb +23 -23
- data/lib/cuke_linter/linters/linter.rb +42 -42
- data/lib/cuke_linter/linters/outline_with_single_example_row_linter.rb +22 -22
- data/lib/cuke_linter/linters/single_test_background_linter.rb +19 -19
- data/lib/cuke_linter/linters/step_with_end_period_linter.rb +19 -19
- data/lib/cuke_linter/linters/step_with_too_many_characters_linter.rb +38 -38
- data/lib/cuke_linter/linters/test_name_with_too_many_characters_linter.rb +38 -38
- data/lib/cuke_linter/linters/test_should_use_background_linter.rb +80 -80
- data/lib/cuke_linter/linters/test_with_action_step_as_final_step_linter.rb +33 -33
- data/lib/cuke_linter/linters/test_with_bad_name_linter.rb +23 -23
- data/lib/cuke_linter/linters/test_with_no_action_step_linter.rb +33 -33
- data/lib/cuke_linter/linters/test_with_no_name_linter.rb +19 -19
- data/lib/cuke_linter/linters/test_with_no_verification_step_linter.rb +33 -33
- data/lib/cuke_linter/linters/test_with_setup_step_after_action_step_linter.rb +46 -46
- data/lib/cuke_linter/linters/test_with_setup_step_after_verification_step_linter.rb +46 -46
- data/lib/cuke_linter/linters/test_with_setup_step_as_final_step_linter.rb +33 -33
- data/lib/cuke_linter/linters/test_with_too_many_steps_linter.rb +27 -27
- data/lib/cuke_linter/version.rb +4 -4
- data/lib/cuke_linter.rb +196 -196
- data/testing/cucumber/features/command_line.feature +202 -202
- data/testing/cucumber/features/configuration/configuring_linters.feature +58 -58
- data/testing/cucumber/features/configuration/locally_scoping_linters.feature +55 -55
- data/testing/cucumber/features/configuration/using_configurations.feature +41 -41
- data/testing/cucumber/features/custom_linters.feature +56 -56
- data/testing/cucumber/features/default_linters.feature +57 -57
- data/testing/cucumber/features/formatters/pretty_formatter.feature +26 -26
- data/testing/cucumber/features/linters/background_does_more_than_setup.feature +84 -84
- data/testing/cucumber/features/linters/element_with_common_tags.feature +28 -28
- data/testing/cucumber/features/linters/element_with_duplicate_tags.feature +71 -71
- data/testing/cucumber/features/linters/element_with_too_many_tags.feature +70 -70
- data/testing/cucumber/features/linters/example_without_name.feature +34 -34
- data/testing/cucumber/features/linters/feature_file_with_invalid_name.feature +20 -20
- data/testing/cucumber/features/linters/feature_file_with_mismatched_name.feature +32 -32
- data/testing/cucumber/features/linters/feature_with_too_many_different_tags.feature +56 -56
- data/testing/cucumber/features/linters/feature_without_description.feature +17 -17
- data/testing/cucumber/features/linters/feature_without_name.feature +18 -18
- data/testing/cucumber/features/linters/feature_without_scenarios.feature +39 -39
- data/testing/cucumber/features/linters/outline_with_single_example_row.feature +23 -23
- data/testing/cucumber/features/linters/single_test_background.feature +24 -24
- data/testing/cucumber/features/linters/step_too_long.feature +43 -43
- data/testing/cucumber/features/linters/step_with_end_period.feature +21 -21
- data/testing/cucumber/features/linters/test_name_too_long.feature +41 -41
- data/testing/cucumber/features/linters/test_should_use_background.feature +29 -29
- data/testing/cucumber/features/linters/test_with_action_as_final_step.feature +50 -50
- data/testing/cucumber/features/linters/test_with_bad_name.feature +29 -29
- data/testing/cucumber/features/linters/test_with_no_action_step.feature +56 -56
- data/testing/cucumber/features/linters/test_with_no_name.feature +23 -23
- data/testing/cucumber/features/linters/test_with_no_verification_step.feature +58 -58
- data/testing/cucumber/features/linters/test_with_setup_step_after_action_step.feature +57 -57
- data/testing/cucumber/features/linters/test_with_setup_step_after_verification_step.feature +57 -57
- data/testing/cucumber/features/linters/test_with_setup_step_as_final_step.feature +50 -50
- data/testing/cucumber/features/linters/test_with_too_many_steps.feature +61 -61
- metadata +21 -25
- data/testing/cucumber/features/linters/rule_without_name.feature +0 -18
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
Feature: Feature without scenarios linter
|
|
2
|
-
|
|
3
|
-
As a writer of documentation
|
|
4
|
-
I want features to have at least one use case
|
|
5
|
-
So that I do not have incomplete documentation
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Linting (Bad)
|
|
9
|
-
Given a linter for features without scenarios
|
|
10
|
-
And the following feature:
|
|
11
|
-
"""
|
|
12
|
-
Feature:
|
|
13
|
-
"""
|
|
14
|
-
When it is linted
|
|
15
|
-
Then an error is reported:
|
|
16
|
-
| linter | problem | location |
|
|
17
|
-
| FeatureWithoutScenariosLinter | Feature has no scenarios | <path_to_file>:1 |
|
|
18
|
-
|
|
19
|
-
Scenario: Linting (Good)
|
|
20
|
-
Given a linter for features without scenarios
|
|
21
|
-
And the following feature:
|
|
22
|
-
"""
|
|
23
|
-
Feature:
|
|
24
|
-
Scenario:
|
|
25
|
-
"""
|
|
26
|
-
When it is linted
|
|
27
|
-
Then no error is reported
|
|
28
|
-
|
|
29
|
-
@cuke_modeler_min_version_3
|
|
30
|
-
Scenario: Linting (Good, with Rules)
|
|
31
|
-
Given a linter for features without scenarios
|
|
32
|
-
And the following feature:
|
|
33
|
-
"""
|
|
34
|
-
Feature:
|
|
35
|
-
Rule:
|
|
36
|
-
Scenario:
|
|
37
|
-
"""
|
|
38
|
-
When it is linted
|
|
39
|
-
Then no error is reported
|
|
1
|
+
Feature: Feature without scenarios linter
|
|
2
|
+
|
|
3
|
+
As a writer of documentation
|
|
4
|
+
I want features to have at least one use case
|
|
5
|
+
So that I do not have incomplete documentation
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Linting (Bad)
|
|
9
|
+
Given a linter for features without scenarios
|
|
10
|
+
And the following feature:
|
|
11
|
+
"""
|
|
12
|
+
Feature:
|
|
13
|
+
"""
|
|
14
|
+
When it is linted
|
|
15
|
+
Then an error is reported:
|
|
16
|
+
| linter | problem | location |
|
|
17
|
+
| FeatureWithoutScenariosLinter | Feature has no scenarios | <path_to_file>:1 |
|
|
18
|
+
|
|
19
|
+
Scenario: Linting (Good)
|
|
20
|
+
Given a linter for features without scenarios
|
|
21
|
+
And the following feature:
|
|
22
|
+
"""
|
|
23
|
+
Feature:
|
|
24
|
+
Scenario:
|
|
25
|
+
"""
|
|
26
|
+
When it is linted
|
|
27
|
+
Then no error is reported
|
|
28
|
+
|
|
29
|
+
@cuke_modeler_min_version_3
|
|
30
|
+
Scenario: Linting (Good, with Rules)
|
|
31
|
+
Given a linter for features without scenarios
|
|
32
|
+
And the following feature:
|
|
33
|
+
"""
|
|
34
|
+
Feature:
|
|
35
|
+
Rule:
|
|
36
|
+
Scenario:
|
|
37
|
+
"""
|
|
38
|
+
When it is linted
|
|
39
|
+
Then no error is reported
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
Feature: Outline with single example row linter
|
|
2
|
-
|
|
3
|
-
As a writer of documentation
|
|
4
|
-
I want outlines to have at least two example rows
|
|
5
|
-
So that I am not needlessly using an outline instead of a scenario
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Linting
|
|
9
|
-
Given a linter for outlines with only one example row
|
|
10
|
-
And the following feature:
|
|
11
|
-
"""
|
|
12
|
-
Feature:
|
|
13
|
-
|
|
14
|
-
Scenario Outline:
|
|
15
|
-
* a step
|
|
16
|
-
Examples:
|
|
17
|
-
| param |
|
|
18
|
-
| value |
|
|
19
|
-
"""
|
|
20
|
-
When it is linted
|
|
21
|
-
Then an error is reported:
|
|
22
|
-
| linter | problem | location |
|
|
23
|
-
| OutlineWithSingleExampleRowLinter | Outline has only one example row | <path_to_file>:3 |
|
|
1
|
+
Feature: Outline with single example row linter
|
|
2
|
+
|
|
3
|
+
As a writer of documentation
|
|
4
|
+
I want outlines to have at least two example rows
|
|
5
|
+
So that I am not needlessly using an outline instead of a scenario
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Linting
|
|
9
|
+
Given a linter for outlines with only one example row
|
|
10
|
+
And the following feature:
|
|
11
|
+
"""
|
|
12
|
+
Feature:
|
|
13
|
+
|
|
14
|
+
Scenario Outline:
|
|
15
|
+
* a step
|
|
16
|
+
Examples:
|
|
17
|
+
| param |
|
|
18
|
+
| value |
|
|
19
|
+
"""
|
|
20
|
+
When it is linted
|
|
21
|
+
Then an error is reported:
|
|
22
|
+
| linter | problem | location |
|
|
23
|
+
| OutlineWithSingleExampleRowLinter | Outline has only one example row | <path_to_file>:3 |
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
Feature: Single test background linter
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
As a writer of documentation
|
|
5
|
-
I want backgrounds to apply to at least two tests
|
|
6
|
-
So that I am not needlessly using a background instead of adding the background steps directly to the test
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Scenario: Linting
|
|
10
|
-
Given a linter for backgrounds applied to only one test
|
|
11
|
-
And the following feature:
|
|
12
|
-
"""
|
|
13
|
-
Feature:
|
|
14
|
-
|
|
15
|
-
Background:
|
|
16
|
-
* a step
|
|
17
|
-
|
|
18
|
-
Scenario:
|
|
19
|
-
* a step
|
|
20
|
-
"""
|
|
21
|
-
When it is linted
|
|
22
|
-
Then an error is reported:
|
|
23
|
-
| linter | problem | location |
|
|
24
|
-
| SingleTestBackgroundLinter | Background used with only one test | <path_to_file>:3 |
|
|
1
|
+
Feature: Single test background linter
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
As a writer of documentation
|
|
5
|
+
I want backgrounds to apply to at least two tests
|
|
6
|
+
So that I am not needlessly using a background instead of adding the background steps directly to the test
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Scenario: Linting
|
|
10
|
+
Given a linter for backgrounds applied to only one test
|
|
11
|
+
And the following feature:
|
|
12
|
+
"""
|
|
13
|
+
Feature:
|
|
14
|
+
|
|
15
|
+
Background:
|
|
16
|
+
* a step
|
|
17
|
+
|
|
18
|
+
Scenario:
|
|
19
|
+
* a step
|
|
20
|
+
"""
|
|
21
|
+
When it is linted
|
|
22
|
+
Then an error is reported:
|
|
23
|
+
| linter | problem | location |
|
|
24
|
+
| SingleTestBackgroundLinter | Background used with only one test | <path_to_file>:3 |
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
Feature: Test step with too many characters
|
|
2
|
-
|
|
3
|
-
As a reader of documentation
|
|
4
|
-
I want test steps not to be unduly long
|
|
5
|
-
So that I can easily understand its purpose
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Linting
|
|
9
|
-
|
|
10
|
-
Given a linter for test steps with too many characters
|
|
11
|
-
And the following feature:
|
|
12
|
-
"""
|
|
13
|
-
Feature:
|
|
14
|
-
|
|
15
|
-
Scenario:
|
|
16
|
-
* tea exists and teapots exist and so do cups and saucers and there might be milk in the milk jug together with sugar cubes
|
|
17
|
-
"""
|
|
18
|
-
When it is linted
|
|
19
|
-
Then an error is reported:
|
|
20
|
-
| linter | problem | location |
|
|
21
|
-
| StepWithTooManyCharactersLinter | Step is too long. 121 characters found (max 80) | <path_to_file>:4 |
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Scenario: Configuration of step count threshold
|
|
25
|
-
|
|
26
|
-
Given a linter for test steps with too many characters has been registered
|
|
27
|
-
And the following configuration file:
|
|
28
|
-
"""
|
|
29
|
-
StepWithTooManyCharactersLinter:
|
|
30
|
-
StepLengthThreshold: 55
|
|
31
|
-
"""
|
|
32
|
-
And the following feature:
|
|
33
|
-
"""
|
|
34
|
-
Feature:
|
|
35
|
-
|
|
36
|
-
Scenario:
|
|
37
|
-
Given that a rose by any other name would still smell as sweet
|
|
38
|
-
"""
|
|
39
|
-
When the configuration file is loaded
|
|
40
|
-
And the feature is linted
|
|
41
|
-
Then an error is reported:
|
|
42
|
-
| linter | problem | location |
|
|
43
|
-
| StepWithTooManyCharactersLinter | Step is too long. 56 characters found (max 55) | <path_to_file>:4 |
|
|
1
|
+
Feature: Test step with too many characters
|
|
2
|
+
|
|
3
|
+
As a reader of documentation
|
|
4
|
+
I want test steps not to be unduly long
|
|
5
|
+
So that I can easily understand its purpose
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Linting
|
|
9
|
+
|
|
10
|
+
Given a linter for test steps with too many characters
|
|
11
|
+
And the following feature:
|
|
12
|
+
"""
|
|
13
|
+
Feature:
|
|
14
|
+
|
|
15
|
+
Scenario:
|
|
16
|
+
* tea exists and teapots exist and so do cups and saucers and there might be milk in the milk jug together with sugar cubes
|
|
17
|
+
"""
|
|
18
|
+
When it is linted
|
|
19
|
+
Then an error is reported:
|
|
20
|
+
| linter | problem | location |
|
|
21
|
+
| StepWithTooManyCharactersLinter | Step is too long. 121 characters found (max 80) | <path_to_file>:4 |
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
Scenario: Configuration of step count threshold
|
|
25
|
+
|
|
26
|
+
Given a linter for test steps with too many characters has been registered
|
|
27
|
+
And the following configuration file:
|
|
28
|
+
"""
|
|
29
|
+
StepWithTooManyCharactersLinter:
|
|
30
|
+
StepLengthThreshold: 55
|
|
31
|
+
"""
|
|
32
|
+
And the following feature:
|
|
33
|
+
"""
|
|
34
|
+
Feature:
|
|
35
|
+
|
|
36
|
+
Scenario:
|
|
37
|
+
Given that a rose by any other name would still smell as sweet
|
|
38
|
+
"""
|
|
39
|
+
When the configuration file is loaded
|
|
40
|
+
And the feature is linted
|
|
41
|
+
Then an error is reported:
|
|
42
|
+
| linter | problem | location |
|
|
43
|
+
| StepWithTooManyCharactersLinter | Step is too long. 56 characters found (max 55) | <path_to_file>:4 |
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
Feature: Step that ends with a period linter
|
|
2
|
-
|
|
3
|
-
As a writer of documentation
|
|
4
|
-
I want to avoid periods at the end of steps
|
|
5
|
-
So that readability is not impacted when the steps are used in other contexts
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Linting
|
|
9
|
-
Given a linter for steps the end with a period
|
|
10
|
-
And the following feature:
|
|
11
|
-
"""
|
|
12
|
-
Feature:
|
|
13
|
-
|
|
14
|
-
Scenario:
|
|
15
|
-
* an okay step
|
|
16
|
-
* a bad step.
|
|
17
|
-
"""
|
|
18
|
-
When it is linted
|
|
19
|
-
Then an error is reported:
|
|
20
|
-
| linter | problem | location |
|
|
21
|
-
| StepWithEndPeriodLinter | Step ends with a period | <path_to_file>:5 |
|
|
1
|
+
Feature: Step that ends with a period linter
|
|
2
|
+
|
|
3
|
+
As a writer of documentation
|
|
4
|
+
I want to avoid periods at the end of steps
|
|
5
|
+
So that readability is not impacted when the steps are used in other contexts
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Linting
|
|
9
|
+
Given a linter for steps the end with a period
|
|
10
|
+
And the following feature:
|
|
11
|
+
"""
|
|
12
|
+
Feature:
|
|
13
|
+
|
|
14
|
+
Scenario:
|
|
15
|
+
* an okay step
|
|
16
|
+
* a bad step.
|
|
17
|
+
"""
|
|
18
|
+
When it is linted
|
|
19
|
+
Then an error is reported:
|
|
20
|
+
| linter | problem | location |
|
|
21
|
+
| StepWithEndPeriodLinter | Step ends with a period | <path_to_file>:5 |
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
Feature: Scenario name with too many characters
|
|
2
|
-
|
|
3
|
-
As a reader of documentation
|
|
4
|
-
I want test names not to be unduly long
|
|
5
|
-
So that I can easily understand its purpose
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Linter
|
|
9
|
-
|
|
10
|
-
Given a linter for test names with too many characters
|
|
11
|
-
And the following feature:
|
|
12
|
-
"""
|
|
13
|
-
Feature:
|
|
14
|
-
|
|
15
|
-
Scenario: tea exists and teapots exist and so do cups and saucers and there might be milk in the milk jug together with sugar cubes
|
|
16
|
-
"""
|
|
17
|
-
When it is linted
|
|
18
|
-
Then an error is reported:
|
|
19
|
-
| linter | problem | location |
|
|
20
|
-
| TestNameWithTooManyCharactersLinter | Scenario name is too long. 121 characters found (max 80) | <path_to_file>:3 |
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Scenario: Configuration of test name count threshold
|
|
24
|
-
|
|
25
|
-
Given a linter for test names with too many characters has been registered
|
|
26
|
-
And the following configuration file:
|
|
27
|
-
"""
|
|
28
|
-
TestNameWithTooManyCharactersLinter:
|
|
29
|
-
TestNameLengthThreshold: 30
|
|
30
|
-
"""
|
|
31
|
-
And the following feature:
|
|
32
|
-
"""
|
|
33
|
-
Feature:
|
|
34
|
-
|
|
35
|
-
Scenario: This scenario name is way too long so it would be better to shorten it somehow, please do so
|
|
36
|
-
"""
|
|
37
|
-
When the configuration file is loaded
|
|
38
|
-
And the feature is linted
|
|
39
|
-
Then an error is reported:
|
|
40
|
-
| linter | problem | location |
|
|
41
|
-
| TestNameWithTooManyCharactersLinter | Scenario name is too long. 92 characters found (max 30) | <path_to_file>:3 |
|
|
1
|
+
Feature: Scenario name with too many characters
|
|
2
|
+
|
|
3
|
+
As a reader of documentation
|
|
4
|
+
I want test names not to be unduly long
|
|
5
|
+
So that I can easily understand its purpose
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Linter
|
|
9
|
+
|
|
10
|
+
Given a linter for test names with too many characters
|
|
11
|
+
And the following feature:
|
|
12
|
+
"""
|
|
13
|
+
Feature:
|
|
14
|
+
|
|
15
|
+
Scenario: tea exists and teapots exist and so do cups and saucers and there might be milk in the milk jug together with sugar cubes
|
|
16
|
+
"""
|
|
17
|
+
When it is linted
|
|
18
|
+
Then an error is reported:
|
|
19
|
+
| linter | problem | location |
|
|
20
|
+
| TestNameWithTooManyCharactersLinter | Scenario name is too long. 121 characters found (max 80) | <path_to_file>:3 |
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
Scenario: Configuration of test name count threshold
|
|
24
|
+
|
|
25
|
+
Given a linter for test names with too many characters has been registered
|
|
26
|
+
And the following configuration file:
|
|
27
|
+
"""
|
|
28
|
+
TestNameWithTooManyCharactersLinter:
|
|
29
|
+
TestNameLengthThreshold: 30
|
|
30
|
+
"""
|
|
31
|
+
And the following feature:
|
|
32
|
+
"""
|
|
33
|
+
Feature:
|
|
34
|
+
|
|
35
|
+
Scenario: This scenario name is way too long so it would be better to shorten it somehow, please do so
|
|
36
|
+
"""
|
|
37
|
+
When the configuration file is loaded
|
|
38
|
+
And the feature is linted
|
|
39
|
+
Then an error is reported:
|
|
40
|
+
| linter | problem | location |
|
|
41
|
+
| TestNameWithTooManyCharactersLinter | Scenario name is too long. 92 characters found (max 30) | <path_to_file>:3 |
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
Feature: Test should use background linter
|
|
2
|
-
|
|
3
|
-
As a writer of documentation
|
|
4
|
-
I want to know if I am including the same steps in every use case
|
|
5
|
-
So that I can use a background to make it clear that a common context exists
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Linting
|
|
9
|
-
|
|
10
|
-
Note: Also works on outlines.
|
|
11
|
-
|
|
12
|
-
Given a linter for tests that should use a background
|
|
13
|
-
And the following feature:
|
|
14
|
-
"""
|
|
15
|
-
Feature:
|
|
16
|
-
|
|
17
|
-
Scenario:
|
|
18
|
-
* a common step
|
|
19
|
-
* a different step
|
|
20
|
-
|
|
21
|
-
Scenario:
|
|
22
|
-
* a common step
|
|
23
|
-
* a more different step
|
|
24
|
-
"""
|
|
25
|
-
When it is linted
|
|
26
|
-
Then an error is reported:
|
|
27
|
-
| linter | problem | location |
|
|
28
|
-
| TestShouldUseBackgroundLinter | Test shares steps with all other tests in feature. Use a background. | <path_to_file>:3 |
|
|
29
|
-
| TestShouldUseBackgroundLinter | Test shares steps with all other tests in feature. Use a background. | <path_to_file>:7 |
|
|
1
|
+
Feature: Test should use background linter
|
|
2
|
+
|
|
3
|
+
As a writer of documentation
|
|
4
|
+
I want to know if I am including the same steps in every use case
|
|
5
|
+
So that I can use a background to make it clear that a common context exists
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Linting
|
|
9
|
+
|
|
10
|
+
Note: Also works on outlines.
|
|
11
|
+
|
|
12
|
+
Given a linter for tests that should use a background
|
|
13
|
+
And the following feature:
|
|
14
|
+
"""
|
|
15
|
+
Feature:
|
|
16
|
+
|
|
17
|
+
Scenario:
|
|
18
|
+
* a common step
|
|
19
|
+
* a different step
|
|
20
|
+
|
|
21
|
+
Scenario:
|
|
22
|
+
* a common step
|
|
23
|
+
* a more different step
|
|
24
|
+
"""
|
|
25
|
+
When it is linted
|
|
26
|
+
Then an error is reported:
|
|
27
|
+
| linter | problem | location |
|
|
28
|
+
| TestShouldUseBackgroundLinter | Test shares steps with all other tests in feature. Use a background. | <path_to_file>:3 |
|
|
29
|
+
| TestShouldUseBackgroundLinter | Test shares steps with all other tests in feature. Use a background. | <path_to_file>:7 |
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
Feature: Test with action step as final step linter
|
|
2
|
-
|
|
3
|
-
As a tester
|
|
4
|
-
I want to be warned about abnormal step flows
|
|
5
|
-
So that the tests make sense
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Scenario: Linting
|
|
9
|
-
|
|
10
|
-
Note: Also works on outlines.
|
|
11
|
-
|
|
12
|
-
Given a linter for tests with an action step as the final step
|
|
13
|
-
And the following feature:
|
|
14
|
-
"""
|
|
15
|
-
Feature:
|
|
16
|
-
|
|
17
|
-
Scenario: Action as final step
|
|
18
|
-
When the last step
|
|
19
|
-
"""
|
|
20
|
-
When it is linted
|
|
21
|
-
Then an error is reported:
|
|
22
|
-
| linter | problem | location |
|
|
23
|
-
| TestWithActionStepAsFinalStepLinter | Test has 'When' as the final step. | <path_to_file>:3 |
|
|
24
|
-
|
|
25
|
-
Scenario: Configuration of keywords for different dialect
|
|
26
|
-
Given a linter for tests with an action step as the final step has been registered
|
|
27
|
-
And the following configuration file:
|
|
28
|
-
"""
|
|
29
|
-
TestWithActionStepAsFinalStepLinter:
|
|
30
|
-
Given:
|
|
31
|
-
- Dado
|
|
32
|
-
When:
|
|
33
|
-
- Quando
|
|
34
|
-
- '*'
|
|
35
|
-
Then:
|
|
36
|
-
- Então
|
|
37
|
-
"""
|
|
38
|
-
And the following feature:
|
|
39
|
-
"""
|
|
40
|
-
# language:pt
|
|
41
|
-
Funcionalidade: Feature name
|
|
42
|
-
|
|
43
|
-
Cenário: scenario name
|
|
44
|
-
Quando this is an action in pt dialect
|
|
45
|
-
"""
|
|
46
|
-
When the configuration file is loaded
|
|
47
|
-
And it is linted
|
|
48
|
-
Then an error is reported:
|
|
49
|
-
| linter | problem | location |
|
|
50
|
-
| TestWithActionStepAsFinalStepLinter | Test has 'When' as the final step. | <path_to_file>:4 |
|
|
1
|
+
Feature: Test with action step as final step linter
|
|
2
|
+
|
|
3
|
+
As a tester
|
|
4
|
+
I want to be warned about abnormal step flows
|
|
5
|
+
So that the tests make sense
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Scenario: Linting
|
|
9
|
+
|
|
10
|
+
Note: Also works on outlines.
|
|
11
|
+
|
|
12
|
+
Given a linter for tests with an action step as the final step
|
|
13
|
+
And the following feature:
|
|
14
|
+
"""
|
|
15
|
+
Feature:
|
|
16
|
+
|
|
17
|
+
Scenario: Action as final step
|
|
18
|
+
When the last step
|
|
19
|
+
"""
|
|
20
|
+
When it is linted
|
|
21
|
+
Then an error is reported:
|
|
22
|
+
| linter | problem | location |
|
|
23
|
+
| TestWithActionStepAsFinalStepLinter | Test has 'When' as the final step. | <path_to_file>:3 |
|
|
24
|
+
|
|
25
|
+
Scenario: Configuration of keywords for different dialect
|
|
26
|
+
Given a linter for tests with an action step as the final step has been registered
|
|
27
|
+
And the following configuration file:
|
|
28
|
+
"""
|
|
29
|
+
TestWithActionStepAsFinalStepLinter:
|
|
30
|
+
Given:
|
|
31
|
+
- Dado
|
|
32
|
+
When:
|
|
33
|
+
- Quando
|
|
34
|
+
- '*'
|
|
35
|
+
Then:
|
|
36
|
+
- Então
|
|
37
|
+
"""
|
|
38
|
+
And the following feature:
|
|
39
|
+
"""
|
|
40
|
+
# language:pt
|
|
41
|
+
Funcionalidade: Feature name
|
|
42
|
+
|
|
43
|
+
Cenário: scenario name
|
|
44
|
+
Quando this is an action in pt dialect
|
|
45
|
+
"""
|
|
46
|
+
When the configuration file is loaded
|
|
47
|
+
And it is linted
|
|
48
|
+
Then an error is reported:
|
|
49
|
+
| linter | problem | location |
|
|
50
|
+
| TestWithActionStepAsFinalStepLinter | Test has 'When' as the final step. | <path_to_file>:4 |
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
Feature: Tests with bad names are reported
|
|
3
|
-
|
|
4
|
-
As a writer of documentation
|
|
5
|
-
I want to be warned about assertion style scenario names
|
|
6
|
-
So that I will be able to understand the intent
|
|
7
|
-
|
|
8
|
-
Scenario Outline: Flag a test with a bad name
|
|
9
|
-
|
|
10
|
-
Note: Also works on outlines.
|
|
11
|
-
|
|
12
|
-
Given a linter for tests with bad names
|
|
13
|
-
And the following feature:
|
|
14
|
-
"""
|
|
15
|
-
Feature: Bad scenario names
|
|
16
|
-
|
|
17
|
-
Scenario: <example_word> scenario name
|
|
18
|
-
This scenario uses a bad name
|
|
19
|
-
"""
|
|
20
|
-
When it is linted
|
|
21
|
-
Then an error is reported:
|
|
22
|
-
| linter | problem | location |
|
|
23
|
-
| TestWithBadNameLinter | "Test", "Verify" and "Check" should not be used in scenario names. | <path_to_file>:3 |
|
|
24
|
-
|
|
25
|
-
Examples:
|
|
26
|
-
| example_word |
|
|
27
|
-
| test |
|
|
28
|
-
| verify |
|
|
29
|
-
| check |
|
|
1
|
+
|
|
2
|
+
Feature: Tests with bad names are reported
|
|
3
|
+
|
|
4
|
+
As a writer of documentation
|
|
5
|
+
I want to be warned about assertion style scenario names
|
|
6
|
+
So that I will be able to understand the intent
|
|
7
|
+
|
|
8
|
+
Scenario Outline: Flag a test with a bad name
|
|
9
|
+
|
|
10
|
+
Note: Also works on outlines.
|
|
11
|
+
|
|
12
|
+
Given a linter for tests with bad names
|
|
13
|
+
And the following feature:
|
|
14
|
+
"""
|
|
15
|
+
Feature: Bad scenario names
|
|
16
|
+
|
|
17
|
+
Scenario: <example_word> scenario name
|
|
18
|
+
This scenario uses a bad name
|
|
19
|
+
"""
|
|
20
|
+
When it is linted
|
|
21
|
+
Then an error is reported:
|
|
22
|
+
| linter | problem | location |
|
|
23
|
+
| TestWithBadNameLinter | "Test", "Verify" and "Check" should not be used in scenario names. | <path_to_file>:3 |
|
|
24
|
+
|
|
25
|
+
Examples:
|
|
26
|
+
| example_word |
|
|
27
|
+
| test |
|
|
28
|
+
| verify |
|
|
29
|
+
| check |
|