vibssingh posted: " HOME In the previous tutorial, I have explained the Generation of Serenity Report (index.html) using Cucumber6 and JUnit. Index.html report that act both as test report and living documentation for the product. It has various views like Overall Te"
In the previous tutorial, I have explained the Generation of Serenity Report (index.html) using Cucumber6 and JUnit. Index.html report that act both as test report and living documentation for the product. It has various views like Overall Test Status, Requirement View, Capabilities View and Features View.
Sometimes it is useful to be able to send a short summary of the test outcomes via email. Serenity allows us to generate a single-page, self-contained HTML summary report, containing an overview of the test results, and a configurable breakdown of the status of different areas of the application.
Pre-Requisite
Java 11 installed
Maven installed
Eclipse or IntelliJ installed
This framework consists of:
Java 11
Maven – 3.8.1
Serenity – 2.6.0
Serenity Maven – 2.6.0
Serenity Cucumber6 – 2.6.0
JUnit – 4.13.2
Maven Surefire Plugin – 3.0.0-M5
Maven Failsafe Plugin – 3.0.0-M5
Maven Comiler Plugin - 3.8.1
Implementation Steps
Update Properties section in Maven pom.xml
Add repositories and pluginRepository to Maven pom.xml
Add Serenity, Serenity Cucumber and JUnit dependencies to POM.xml
Update Build Section of pom.xml
Create source folder – src/test/resources and features folder within src/test/resources to create test scenarios in Feature file
Create the Step Definition class or Glue Code
Create a Serenity-Cucumber Runner class
Create serenity.conf file under src/test/resources
Create serenity.properties file in the root of the project
Run the tests through commandline which generates Serenity Report
To know about Step 1 to 3, please refer here. These steps are same for Index.html report and emailable report.
Now, add the below mentioned plugin. These reports are configured in the Serenity Maven plugin, where you need to do two things. First, you need to add a dependency for the serenity-emailer module in the plugin configuration. Then, you need to tell Serenity to generate the email report when it performs the aggregation task.
I have provided the location of firefoxdriver through commandline. I believe this is the best way to run the test. We can hard-code the path in the test code or in serenity.conf file. In that case, you don't need to provide location of firefoxdriver through command line. You can use below command.
mvn verify
This image show that two different type of reports are generated by Serenity - Full Report (index.html) and Single Page HTML Summary ( serenity-summary.html ).
This emailable report is called serenity-summary.html. This is generated under site/serenity/ serenity-summary.html
You can see a sample of such a report here:
As you can see in the above execution status, out of six tests, one test is failed. The same information is displayed in the report.
This report provides summary of the test execution.
The Functional Coverage section lets us highlight key areas of your application. By default, this section will list test results for each Feature. But we can configure the report to group results by other tags as well.
We are done! Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!!
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.