-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser.feature
More file actions
83 lines (77 loc) · 2.34 KB
/
parser.feature
File metadata and controls
83 lines (77 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Feature: Gherkin Parser
As a developer using co-gherkin
I want to parse Gherkin feature files
So that I can execute BDD scenarios
Scenario: Parse a simple feature
Given I have a feature file with content:
"""
Feature: Login
Scenario: Successful login
Given I am on login page
When I enter credentials
Then I see dashboard
"""
When I parse the feature file
Then it should contain 1 feature
And the feature name should be "Login"
And it should contain 1 scenario
And the scenario should have 3 steps
Scenario: Parse Background
Given I have a feature file with Background:
"""
Feature: Shopping
Background:
Given I am logged in
And I have an empty cart
Scenario: Add item
When I add "Apples" to the cart
Then the cart should contain "Apples"
"""
When I parse the feature file
Then the Background should have 2 steps
And the Scenario should have 2 steps
Scenario: Parse Scenario Outline
Given I have a feature file with Scenario Outline:
"""
Feature: Calculator
Scenario Outline: Add numbers
Given I have entered <a>
And I have entered <b>
When I press add
Then the result is <result>
Examples:
| a | b | result |
| 1 | 2 | 3 |
| 5 | 7 | 12 |
"""
When I parse the feature file
Then it should generate 2 scenarios from examples
And each scenario should have parameters replaced
Scenario: Parse Data Tables
Given I have a feature file with data table:
"""
Feature: Users
Scenario: Create users
Given the following users:
| name | email |
| Alice | alice@test.com |
| Bob | bob@test.com |
"""
When I parse the feature file
Then the step should have a data table with 3 rows
And the data table should have 2 columns
Scenario: Parse multi-line strings
Given I have a feature file with docstring:
"""
Feature: API
Scenario: Send request
Given I have a request body:
\"\"\"
{
"name": "test",
"value": 123
}
\"\"\"
"""
When I parse the feature file
Then the step should have a docstring parameter