Execute Behat scenario using line number

Profile picture for user devraj

There are several ways to execute a particular scenario directly out of several scenarios in a Behat feature file. One of them is to use the line number where scenario starts.

To execute Scenario: Verify user login use below command

$ bin/behat features/Login.feature:11

Here you need to specify behat command then path of feature file along with its name and then line number of scenario. Similarly you can execute scenario outline by specifying line number 18.

Line number is not applicable to feature, you can not execute feature file by specifying line number 3. In case you will give wrong line number you will get this error.

 No specifications found at path(s) `features/Login.feature:34`. This might be because of incorrect paths configuration in your `suites`.