Pages

Run cucumber using line number?

How to Run cucumber scenario using Line Number?

  • There are many ways to run cucumber scenarios. One of the easiest ways is to run by using the Line number.
Let's say I have 2 sample scenarios in FirstFeatureFile.feature file:

cucumber scenario using Line Number
cucumber scenario using Line Number

Here, I have 2 scenarios, one is on Line 4 and the other is on Line 7.

Now, run a single scenario using Line number:
Run cucumber scenario using Line Number
Run cucumber scenario using Line Number

Here, we observe Line on 4, the scenario is executed.


Now we will run multiple scenarios using Line Numbers.

Run Cucumber scenarios using Line Numbers
Run Cucumber scenarios using Line Numbers
Here, we observe 2 scenarios executed based on Line numbers 4,7.

So, we have to use ":" between Line numbers.

If we give the invalid line number, it will not execute any scenario(s).
Cucumber using line number
Cucumber scenario using line number

We observe, at Line:100 we don't have any scenario in feature .so it won't execute any scenario in a feature file.

Please comment below to feedback or ask questions.

No comments:

Post a Comment

Please comment below to feedback or ask questions.