-
Notifications
You must be signed in to change notification settings - Fork 234
Update readme accordingly #441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,11 +109,6 @@ test_publish_article.py: | |
| Scenario decorator | ||
| ------------------ | ||
|
|
||
| The scenario decorator can accept the following optional keyword arguments: | ||
|
|
||
| * ``encoding`` - decode content of feature file in specific encoding. UTF-8 is default. | ||
| * ``example_converters`` - mapping to pass functions to convert example values provided in feature files. | ||
|
|
||
| Functions decorated with the `scenario` decorator behave like a normal test function, | ||
| and they will be executed after all scenario steps. | ||
| You can consider it as a normal pytest test function, e.g. order fixtures there, | ||
|
|
@@ -555,25 +550,24 @@ The code will look like: | |
| @scenario( | ||
| "outline.feature", | ||
| "Outlined given, when, thens", | ||
| example_converters=dict(start=int, eat=float, left=str) | ||
| ) | ||
| def test_outlined(): | ||
| pass | ||
|
|
||
|
|
||
| @given("there are <start> cucumbers", target_fixture="start_cucumbers") | ||
| @given(parsers.parse("there are {start} cucumbers", target_fixture="start_cucumbers")) | ||
| def start_cucumbers(start): | ||
| assert isinstance(start, int) | ||
| return dict(start=start) | ||
|
|
||
|
|
||
| @when("I eat <eat> cucumbers") | ||
| @when(parsers.parse("I eat {eat} cucumbers")) | ||
| def eat_cucumbers(start_cucumbers, eat): | ||
| assert isinstance(eat, float) | ||
| start_cucumbers["eat"] = eat | ||
|
|
||
|
|
||
| @then("I should have <left> cucumbers") | ||
| @then(parsers.parse("I should have {left} cucumbers")) | ||
| def should_have_left_cucumbers(start_cucumbers, start, eat, left): | ||
| assert isinstance(left, str) | ||
| assert start - eat == int(left) | ||
|
|
@@ -672,17 +666,17 @@ The code will look like: | |
| """We don't need to do anything here, everything will be managed by the scenario decorator.""" | ||
|
|
||
|
|
||
| @given("there are <start> cucumbers", target_fixture="start_cucumbers") | ||
| @given(parsers.parse("there are {start} cucumbers"), target_fixture="start_cucumbers") | ||
| def start_cucumbers(start): | ||
| return dict(start=start) | ||
|
|
||
|
|
||
| @when("I eat <eat> cucumbers") | ||
| @when(parsers.parse("I eat {eat} cucumbers")) | ||
| def eat_cucumbers(start_cucumbers, start, eat): | ||
| start_cucumbers["eat"] = eat | ||
|
|
||
|
|
||
| @then("I should have <left> cucumbers") | ||
| @then(parsers.parse("I should have {left} cucumbers")) | ||
| def should_have_left_cucumbers(start_cucumbers, start, eat, left): | ||
| assert start - eat == left | ||
| assert start_cucumbers["start"] == start | ||
|
|
@@ -1208,6 +1202,29 @@ As as side effect, the tool will validate the files for format errors, also some | |
| ordering of the types of the steps. | ||
|
|
||
|
|
||
| .. _Migration from 4.x.x: | ||
|
|
||
| Migration of your tests from versions 4.x.x | ||
| ------------------------------------------- | ||
|
|
||
| The templated steps should use step argument parsers in order to match the scenario outlines | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should also mention that the values of the examples will not be injected as fixtures anymore
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| and get the values from the example tables. The values from the example tables are no longer | ||
| passed as fixtures. | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| # Instead of | ||
| # @given("there are <cucumbers> in the box") | ||
| # def given_cucumbers(cucumbers): | ||
| # pass | ||
|
|
||
| @given(parsers.parse("there are {cucumbers} in the box")) | ||
| def given_cucumbers(cucumbers): | ||
| pass | ||
|
|
||
|
|
||
| Scenario `example_converters` are removed in favor of the converters provided on the step level. | ||
|
|
||
| .. _Migration from 3.x.x: | ||
|
|
||
| Migration of your tests from versions 3.x.x | ||
|
|
@@ -1240,7 +1257,6 @@ as well as ``bdd_strict_gherkin`` from the ini files. | |
|
|
||
| Step validation handlers for the hook ``pytest_bdd_step_validation_error`` should be removed. | ||
|
|
||
|
|
||
| License | ||
| ------- | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.