@@ -156,6 +156,55 @@ default author.
156
156
And there's an article
157
157
158
158
159
+ Using Asterisks in Place of Keywords
160
+ ------------------------------------
161
+
162
+ To avoid redundancy or unnecessary repetition of keywords
163
+ such as "And" or "But" in Gherkin scenarios,
164
+ you can use an asterisk (*) as a shorthand.
165
+ The asterisk acts as a wildcard, allowing for the same functionality
166
+ without repeating the keyword explicitly.
167
+ It improves readability by making the steps easier to follow,
168
+ especially when the specific keyword does not add value to the scenario's clarity.
169
+
170
+ The asterisk will work the same as other step keywords - Given, When, Then - it follows.
171
+
172
+ For example:
173
+
174
+ .. code-block :: gherkin
175
+
176
+ Feature: Resource owner
177
+ Scenario: I'm the author
178
+ Given I'm an author
179
+ * I have an article
180
+ * I have a pen
181
+
182
+
183
+ .. code-block :: python
184
+
185
+ from pytest_bdd import given
186
+
187
+ @given (" I'm an author" )
188
+ def _ ():
189
+ pass
190
+
191
+ @given (" I have an article" )
192
+ def _ ():
193
+ pass
194
+
195
+ @given (" I have a pen" )
196
+ def _ ():
197
+ pass
198
+
199
+
200
+ In the scenario above, the asterisk (*) replaces the And or Given keywords.
201
+ This allows for cleaner scenarios while still linking related steps together in the context of the scenario.
202
+
203
+ This approach is particularly useful when you have a series of steps
204
+ that do not require explicitly stating whether they are part of the "Given", "When", or "Then" context
205
+ but are part of the logical flow of the scenario.
206
+
207
+
159
208
Step arguments
160
209
--------------
161
210
0 commit comments