Skip to content

Commit c59d662

Browse files
author
Ludovic CHAPELET
committed
tests: add tests
1 parent 6220aa6 commit c59d662

File tree

2 files changed

+308
-49
lines changed

2 files changed

+308
-49
lines changed

tests/parser/test.feature

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Feature: User login
99
# Background steps run before each scenario
1010
Given the login page is open
1111

12-
# Scenario within the rule
12+
# Scenario within the rule
1313
Scenario: Successful login with valid credentials
1414
Given the user enters a valid username
1515
And the user enters a valid password
@@ -22,7 +22,7 @@ Feature: User login
2222
When the user clicks the login button
2323
Then the user should see an error message "<error_message>"
2424

25-
# Examples table provides data for the scenario outline
25+
# Examples table provides data for the scenario outline
2626
Examples:
2727
| username | password | error_message |
2828
| invalidUser | wrongPass | Invalid username or password |
@@ -83,15 +83,32 @@ Feature: User login
8383
Please check your username and password and try again.
8484
If the problem persists, contact support.
8585
"""
86+
# Tags can also be used on exemples
87+
@scenario_tag
88+
Scenario Outline: Test tags on Examples
89+
Given the user enters "<username>" as username
90+
And the user enters "<password>" as password
91+
When the user clicks the login button
92+
Then the user should see an error message "<error_message>"
93+
94+
@example_tag_1
95+
Examples:
96+
| username | password | error_message |
97+
| invalidUser | wrongPass | Invalid username or password |
98+
99+
@example_tag_2
100+
Examples:
101+
| username | password | error_message |
102+
| user123 | incorrect | Invalid username or password |
86103

87104
@some-tag
88105
Rule: a sale cannot happen if there is no stock
89-
# Unhappy path
90-
Example: No chocolates left
91-
Given the customer has 100 cents
92-
And there are no chocolate bars in stock
93-
When the customer tries to buy a 1 cent chocolate bar
94-
Then the sale should not happen
106+
# Unhappy path
107+
Example: No chocolates left
108+
Given the customer has 100 cents
109+
And there are no chocolate bars in stock
110+
When the customer tries to buy a 1 cent chocolate bar
111+
Then the sale should not happen
95112

96113
Rule: A sale cannot happen if the customer does not have enough money
97114
# Unhappy path
@@ -107,3 +124,4 @@ Feature: User login
107124
And there are chocolate bars in stock
108125
When the customer tries to buy a 75 cent chocolate bar
109126
Then the sale should happen
127+

0 commit comments

Comments
 (0)