Cucumber tags help in filtering the scenarios. We can tag the scenarios and then run them based on tags.
- We can add tags to scenarios with the <@> symbol.
- We can use the following command to run a cucumber tagged scenario.
Executed tagged Scenario using Command-Line:
cucumber features -t @tag_name
Execute tagged Scenario using Java Cucumber Options
@CucumberOptions(
plugin = {"pretty", "html:target/cucumber"},
features = {"features"},
glue={"com.pb.cucumbertest.stepdefinitions"},
tags = {"@login"}
)
Above code will execute scenario which are tagged with @login.