In the previous tutorial, I explained the generation of Serenity Report. In this tutorial, I will explain how to generate the Serenity Report in Customized path.
Before going through this tutorial, please refer to the tutorial for Serenity Report Generation.
Add outputDirectory to serenity-maven-plugin and mention the path where we want to save our Reports.
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>${serenity.version}</version>
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-single-page-report</artifactId>
<version>${serenity.version}</version>
</dependency>
</dependencies>
<configuration>
<tags>${tags}</tags>
<reports>single-page-html</reports>
</configuration>
<executions>
<execution>
<id>serenity-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>aggregate</goal>
</goals>
<configuration>
<outputDirectory>C:\\Users\\Vibha\\Projects\\Vibha_Personal\\DetailedReport</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
.........
Execute the tests using the command line
mvn clean verify
You can see that the reports are generated at the above-specified path.


Another way is to add outputDirectory detail in serenity.properties file.
serenity.project.name = Serenity and Cucumber Report Demo
serenity.outputDirectory=C:\\Users\\Reports\\SerenityReports\\SummaryReport

How to create a Serenity Report for specified tests?
Suppose we want to run a set of tests, not a complete test suite, and we want to get the report containing the details of only executed tests, in the short a very specific report. This can be achieved by using @tags.
Suppose you mark each test suite with a tag @E2E. So to run only the tests for the @E2E, you could run the following:
mvn clean verify -Dtags="E2E"
You will also need to configure the serenity-maven-plugin to use the tags you provide at the command line:
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>${serenity.version}</version>
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-single-page-report</artifactId>
<version>${serenity.version}</version>
</dependency>
</dependencies>
<configuration>
<tags>${tags}</tags>
<reports>single-page-html</reports>
</configuration>
.........
When you run the tests with this configuration, you will get a test report with only the tests related to the @E2E tag.

We are done! Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!!