Tuesday

Serenity Maven Cucumber - Only run specific scenarios



Problem: While using the serenity cucumber framework with maven run only specific scenarios or feature files

Solution: To run only individual feature, run a specific tag say @wip

Work In Progress tag @wip

mvn verify -Dcucumber.options="--tags @wip"

mvn verify -Dcucumber.options="--tags @wip @debug2"

More -DCucumber.options here: http://cucumber.github.io/api/cucumber/jvm/javadoc/cucumber/api/CucumberOptions.html#tags--

You can also do this by creating test runner class for each .feature file:
@RunWith(CucumberWithSerenity.class)
@CucumberOptions(features = "src/test/resources/features/search/search_by_keyword.feature")
public class SearchByKeyword {
}
Triggering this as any other test class, would execute only the SearchByKeyword.feature.

No comments:

Post a Comment