-
Notifications
You must be signed in to change notification settings - Fork 0
First working version of the pytest-bdd POC #1
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
Open
pabloge
wants to merge
3
commits into
master
Choose a base branch
from
poc/pytest
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| FROM python:3.7.15-slim | ||
|
|
||
| COPY requirements.txt requirements.txt | ||
| RUN pip3 install -r requirements.txt --extra-index-url http://artifactory.hi.inet/artifactory/api/pypi/pypi-release-local/simple/ --trusted-host artifactory.hi.inet | ||
| RUN pip3 install -r requirements.txt | ||
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 |
|---|---|---|
| @@ -1,13 +1,14 @@ | ||
| """ | ||
| Copyright (c) Telefónica Digital. CDCO QA Team <qacdco@telefonica.com> | ||
| """ | ||
| from pytest_bdd import given, when, then, step, parsers | ||
|
|
||
| from toolium_telefonica.behave.decorators import step | ||
| from toolium_telefonica.behave.steps.tools.storage import add_value_to_storage_with_key | ||
|
|
||
| @given(parsers.parse('the value "{expected_result:d}" is stored'), target_fixture="expected_result") | ||
| def set_expected_result(expected_result): | ||
| return expected_result | ||
|
|
||
| @step('I add "{value1}" to "{value2}" and store the result as "{name}"') | ||
| def add_values_and_store_result(context, value1, value2, name): | ||
| result = value1 + value2 | ||
| context.logger.info(f'Result generated: {result}') | ||
| add_value_to_storage_with_key(context, result, name) | ||
| @when(parsers.parse('I add "{sum1:d}" to "{sum2:d}" and store the result'), target_fixture="real_result") | ||
| def set_real_result(sum1, sum2): | ||
| return sum1 + sum2 | ||
|
|
||
| @then('the two values stored are equal') | ||
| def compare_results(expected_result, real_result): | ||
| assert expected_result == real_result |
File renamed without changes.
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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from pytest_bdd import scenarios | ||
| from common.steps import * | ||
|
|
||
|
|
||
| # Escenarios | ||
| scenarios('component/feature1') | ||
| scenarios('component/feature2') |
This file was deleted.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -1,7 +1,12 @@ | ||
| Feature: Example | ||
|
|
||
| @1 | ||
| Scenario: Example 1 | ||
| Given the value "5" is stored in the context storage with key "expected_result" | ||
| When I add "2" to "3" and store the result as "result" | ||
| Then the values stored in the context storage with keys "expected_result" and "result" are equal | ||
| Scenario Outline: Example 1 | ||
| Given the value "5" is stored | ||
| When I add "<value1>" to "<value2>" and store the result | ||
| Then the two values stored are equal | ||
|
|
||
| Examples: | ||
| | value1 | value2 | | ||
| | 2 | 3 | | ||
| | 3 | 2 | |
Empty file.
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -1,7 +1,12 @@ | ||
| Feature: Example | ||
|
|
||
| @1 | ||
| Scenario: Example 1 | ||
| Given the value "5" is stored in the context storage with key "expected_result" | ||
| When I add "2" to "3" and store the result as "result" | ||
| Then the values stored in the context storage with keys "expected_result" and "result" are equal | ||
| Scenario Outline: Example 1 | ||
| Given the value "5" is stored | ||
| When I add "<value1>" to "<value2>" and store the result | ||
| Then the two values stored are equal | ||
|
|
||
| Examples: | ||
| | value1 | value2 | | ||
| | 2 | 3 | | ||
| | 3 | 2 | |
Empty file.
This file was deleted.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| [pytest] | ||
| testpaths = common/tests | ||
| bdd_features_base_dir = features | ||
| markers: | ||
| 1: run tests labeled as @1 |
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 |
|---|---|---|
| @@ -1 +1 @@ | ||
| toolium-telefonica==5.2.0 | ||
| pytest-bdd==6.1.1 |
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.