You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+52Lines changed: 52 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -513,6 +513,58 @@ Example:
513
513
defshould_have_left_cucumbers(cucumbers, left):
514
514
assert cucumbers["start"] - cucumbers["eat"] == left
515
515
516
+
517
+
Example parameters from example tables can not only be used in steps, but also embedded directly within docstrings and datatables, allowing for dynamic substitution.
518
+
This provides added flexibility for scenarios that require complex setups or validations.
519
+
520
+
Example:
521
+
522
+
.. code-block:: gherkin
523
+
524
+
# content of docstring_and_datatable_with_params.feature
525
+
526
+
Feature: Docstring and Datatable with example parameters
527
+
Scenario Outline: Using parameters in docstrings and datatables
528
+
Given the following configuration:
529
+
"""
530
+
username: <username>
531
+
password: <password>
532
+
"""
533
+
When the user logs in
534
+
Then the response should contain:
535
+
| field | value |
536
+
| username | <username> |
537
+
| logged_in | true |
538
+
539
+
Examples:
540
+
| username | password |
541
+
| user1 | pass123 |
542
+
| user2 | 123secure |
543
+
544
+
.. code-block:: python
545
+
546
+
from pytest_bdd import scenarios, given, when, then
0 commit comments