pytest-bdd
pytest-bdd copied to clipboard
Fixes #271: Use parametrize markers params for getting example_kwargs
User can parametrize scenario by using examples specified in feature files. In that case pytest parametrize marker is updated with examples parameters.
We also provide a way to parametrize scenario on the python side by using pytest.mark.parametrize. https://pytest-bdd.readthedocs.io/en/latest/#combine-scenario-outline-and-pytest-parametrization
The problem with gherkin reporting is that when we are getting self.example_kwargs, we are using scenario.get_example_params() method that takes into account only args that are defined inside feature file (examples), and skips pytest.mark.parametrize parameters.
For gherkin reporting we need all parameters: those specified in feature files and those specified by using pytest.mark.parametrize decorator.
This pull requests uses parametrize marker to get all args.
Coverage increased (+0.3%) to 93.817% when pulling 0646548b6ae0bc7343890fd16f6e7a1b811d22d2 on sliwinski-milosz:gherkin_reporter_parametrized_tests_fix into 72a8764556cdecb96c8ce44861af8de1a5726c9c on pytest-dev:master.
Please before merging, let me add similar test as in fix of unicode steps (but to do that easily unicode steps fix needs to be merged)
I added test and I made test function bit more generic.
However I still think that it would be good to firstly merge the fix for CI tests :)
Please note that "work in progress" label can be removed. This pull request is ready for review.
I think this PR is also ready for review :)