Skip to main content

Tags & Filtering Tests

In cucumber it's possible to tag your tests to categorize them. These tags can be used to filter scenarios which can or cannot run.

@web and not @mobile

When applied to the following feature file, only the first test will run

Feature: Some Feature
@web
Scenario: A scenario we only care about on web
Given .....

@mobile
Scenario: A scenario we only care about on mobile
Given ...

To apply a filter to a test, add it as the environment variable CUCUMBER_FILTER

In Shell/Terminal
export CUCUMBER_FILTER="@web and not @mobile"
In Powershell
$env:CUCUMBER_FILTER = "@web and not @mobile"
In .env file
CUCUMBER_FILTER="@web and not @mobile"