pytest-dev / pytest-bdd

BDD library for the pytest runner
https://pytest-bdd.readthedocs.io/en/latest/
MIT License
1.3k stars 218 forks source link

Step name doesn't contain argument value in scenario outline #235

Open andreypetrenko82 opened 6 years ago

andreypetrenko82 commented 6 years ago

When I use scenario outline, and I can see that step name doesn't contain argument value in report. In debug mode we can see that step.name contains just a name of argument. And in step_func_args we can see a value of this argument. But generated report via --cucumberjson has just a step with argument name (not its value). Example:

Then I select <user_role> role
    Examples: user roles
      | user_role  |
      | Custom     |

And as a result generated report should contain: Then I select Custom role But it contains just an argument name: Then I select <user_role> role

olegpidsadnyi commented 6 years ago

@andreypetrenko82 is it related to the new pytest? could you submit the complete test?

slawek367 commented 6 years ago

Hi, i saw something similar for example when I start test with: py.test --gherkin-terminal-reporter functional/some_test.py

Output contain only keys from example table but not values, so if you implement example: Examples: | some_key | | value1 | | value2 |

You will se in output: for value1: Given some ... for value2: Given some ...

Instead: Given some value1 Given some value2

It is clear now?

vinhntb commented 6 years ago

@olegpidsadnyi It's same issue #202. My scenario:

Feature: This is example
Scenario Outline: Outlined given, when, thens
    Given there are <start> cucumbers
    When I eat <eat> cucumbers
    Then I should have <left> cucumbers

    Examples:
    | start | eat | left |
    |  12   |  5  |  7   |
    |  5    |  4  |  1   |

Command used: py.test -s -vvv --gherkin-terminal-reporter And output: image

sliwinski-milosz commented 5 years ago

For Cucumber format add --cucumberjson-expanded to your command:

py.test --cucumberjson=<path to json report> --cucumberjson-expanded

For Gherkin reporter add --gherkin-terminal-reporter-expanded to your command:

py.test -s -vvv --gherkin-terminal-reporter --gherkin-terminal-reporter-expanded