Is there any way to run selective tests from Cucumber BDD Example section without commenting the lines?
For instance, from the example below, I would like to run 2nd row of test without commenting 1st & 3rd rows.
Scenario Outline: Test Scenario
Given logged into the test application using <username> and <password>
When user is navigated to home screen
Then user should be able to find home menus
Examples:
| username | password |
| test1 | pwd1 |
| test2 | pwd2 |
| test3 | pwd3 |
I was working with C# - SpecFlow where I could achieve this using Test Explorer window. With SpecFlow & MS Visual Studio Test Explorer, user would be able to load all the tests and run single / selective tests easily. So would like to find similar option in Cucumber Java as well. Please help.
Consider splitting up the examples table into two and using tags on them. Then run the test with the desired tags in cucumberoptions
of your runner class to filter them accordingly. If you leave out tags option all tests will run.
Scenario Outline: Test Scenario
Given logged into the test application using <username> and <password>
When user is navigated to home screen
Then user should be able to find home menus
@RunSecond
Examples:
| username | password |
| test2 | pwd2 |
@RunOthers
Examples:
| username | password |
| test1 | pwd1 |
| test3 | pwd3 |
In ruby cukes I think you can run test2 by telling cukes the line number of the example. So lets say the scenario is called foo, and the line your test2 example is on is line 25 then
cucumber features/foo.feature:25
would do what you ask.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.