Skip to main content

Execute Behat scenario using line number

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`. 

Submitted by tgoswami on October 21, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.