3

I know it's possible to run specific examples in cucumber

cucumber tests/features/my.feature:141 #just example 141
cucumber tests/features/my.feature:141:151 #just examples 141 & 151

What is the syntax to run a range of examples from 141 to 151?

cucumber tests/features/my.feature:141-151 #this does not work

If it helps, Here is the Scenario Outline snippet... assuming 'tc-44' is on line 141 in the file

Scenario Outline: running scenario subset of examples 
Given we are testing a subset
 And it is a scenario outline with many examples
Then we can run a subset by providing a range
Examples:
| test-case |
| tc-44 |
| tc-45 |
| tc-46 |
| tc-47 |
| tc-48 |
| tc-49 |
...
| tc-100 |

1 Answer 1

2

From the command line you can run specific scenarios from the same feature file using a colon between the line numbers, like this:

cucumber tests/features/my.feature:37:52

If scenarios are defined at lines 37 and 52, both would be executed by cucumber.

You can likewise run specific examples by referencing their line number. In your case, this would work:

cucumber tests/features/my.feature:141:142:143:144:145:146:147:148:149:150:151

Cucumber will execute the example found at each line number.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.