Integrating allure report with RestAssured

 


Rest assured is a powerful java library that helps us test our api. However, to use this library properly the approach is to create a test framework. One of the major points of a test framework is to enable the testers to gain insights into the results generated from the execution of the test. In this post I will show the simple steps we can follow to use the Allure reporting within a maven project for the RestAssured test.

When we create a test framework with maven, it provides us with a pom.xml that enables us to add the required dependencies. To start off we need to add the allure dependencies to the pom file.

<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.14.0</version>
</dependency>


Once the dependency is added our first step is achieved. Next we need to obtain the Allure reporter. To get this navigate to the allure framework on git hub and get the latest allure 2 version downloaded[1] to your machine.

[1]https://github.com/allure-framework


Once the allure is downloaded you should have a zip file such as allure-2.14.0 available with you. Next, access the location of your RestAssured test framework, and from the location of the pom file execute the command mvn clean test suit once, the execution is complete, you in your project a folder structure should have a folder structure as below.



Once the above steps are complete, our next step is to view the results on allure to achieve this we need to execute a command as below from the bin folder of the allure-2.14.0 as[2]                                                                                                                                                                                                                                        

[2]./allure generate  <path-to-allure-results-folder> --clean  -o allure-report && allure open allure-report



Allure report will be generated on your localhost with an output as shown below



For this blog I downloaded the allure report generator from the below location[3]:

[3]https://github.com/allure-framework/allure2/releases/tag/2.14.0




Comments