pytest-bdd icon indicating copy to clipboard operation
pytest-bdd copied to clipboard

Fixes #271: Use parametrize markers params for getting example_kwargs

Open sliwinski-milosz opened this issue 6 years ago • 5 comments
trafficstars

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.

sliwinski-milosz avatar Nov 24 '18 09:11 sliwinski-milosz

Coverage Status

Coverage increased (+0.3%) to 93.817% when pulling 0646548b6ae0bc7343890fd16f6e7a1b811d22d2 on sliwinski-milosz:gherkin_reporter_parametrized_tests_fix into 72a8764556cdecb96c8ce44861af8de1a5726c9c on pytest-dev:master.

coveralls avatar Nov 24 '18 10:11 coveralls

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)

sliwinski-milosz avatar Nov 25 '18 13:11 sliwinski-milosz

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 :)

sliwinski-milosz avatar Dec 19 '18 08:12 sliwinski-milosz

Please note that "work in progress" label can be removed. This pull request is ready for review.

sliwinski-milosz avatar Feb 17 '19 10:02 sliwinski-milosz

I think this PR is also ready for review :)

sliwinski-milosz avatar Jul 09 '19 08:07 sliwinski-milosz