Filtering Reports

In Serenity BDD, you can use tags to generate this kind of focused report.

This works very naturally with Cucumber test scenarios. For example, in the following feature file, we have used the @sprint-2 tag to indicate that the scenario is scheduled for Sprint 2.

Scenario: Buyer orders a coffee
  Given Cathy has a Caffeinate-Me account
  When she orders a large cappuccino
  Then Cathy should receive the order

Tagging also works with JUnit test, as illustrated here:

public class WhenAddingNumbers {

    MathWizSteps michael;

    public void addingSums() {
        // Given

        // When

        // Then


mvn clean verify -Dtags="sprint-2"

When using Cucumber, we need to use the cucumber.options property to indicate which scenarios should be executed. For example, the following command runs all of the Cucumber scenarios with the @sprint-2 tag":

mvn clean verify -Dcucumber.options="--tags=@sprint-2"

Excluding Unrelated Requirements

By default, when you use the tags option, Serenity will filter your requirements as best it can to report only the requirements that are relevant to the specified tag.

Requirements filtering only happens if you specify the tags option. So this will produce a full set of requirements in the Requirements page.

$ mvn clean verify -Dcucumber.options="--tags @sprint-2"

But this will report only the requirements that are related to the executed tests.

$ mvn clean verify -Dcucumber.options="--tags @sprint-2" -Dtags=sprint-2

If you have already run the full set of tests, you can also produce a filtered aggregate report, in which case you don’t need to provide the cucumber.options property:

$ mvn serenity:aggregate -Dtags=sprint-2

Using custom requirements structures

By default, requirements filtering will a