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

Scenario Outline to select examples based on user arguments?

Open CuriousQA opened this issue 5 years ago • 0 comments
trafficstars

Scenario outline has multiple example tables with env1,env2,2nv3 etc. Is there any way to collect only Examples: env1 out of other Examples when user passes the argument env1. Basically the details are different among environments, so I cant use the markers as well. As markers on one example table might not work on another.

@Validate Scenario Outline: Test to be executed in multiple env Given the and

Examples: env1 |username|password| |aa|nn|

Examples: env2 |username|password| |aaq|nna|

Examples: env3 |username|password| |aaa|n1n|

When I run pytest, I pass pytest --env=env1. Here I would like my pytest to execute only env1 examples.

I have following options

  1. to place individual markers to each and run
  2. to add new column and verify

Wondering if we have any good/reasonable approach.

Regards, Tom.

CuriousQA avatar May 29 '20 17:05 CuriousQA