Running a Subset of Scenarios

As the number of features and scenarios grows, we’ll frequently run into situations where we want to run only a single (or maybe a couple) of scenarios to get faster feedback. This can be if we are working on a new scenario or if we have broken an existing one. Let’s take a closer look at how this works.

Filtering with Tag Expressions

The simplest way to use the --tags option is to give it a single tag to run, for example:

 $ ​​cucumber​​ ​​--tags​​ ​​@focus

This would cause Cucumber to run just the scenarios tagged with @focus. It’s quite common to temporarily tag a scenario or feature with a unique tag like this to filter what to run.

In some situations, we may want a little more control over the tag filtering. ...

Get The Cucumber Book, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.