Saturday, May 14, 2022

Reporting with Allure Report with Rest Assured

 To generate a better looking report with attachment is required in automation testing to know the details of the execution.

Allure report is a reporting api which can be used to get all the facility.

Now we can learn in details in the following steps:

Step 1:

Create a maven project and use the following pom.xml file.

<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
        <!-- -->
        <!-- -->
        <!-- -->
        <!-- -->

Step 2:

package com.blogspot.startingwithseleniumwebdriver;

import org.testng.annotations.Test;

import io.qameta.allure.restassured.AllureRestAssured;
import io.restassured.RestAssured;
import io.restassured.builder.RequestSpecBuilder;
import io.restassured.specification.RequestSpecification;

public class TestAllureReportRestAssured {

    private void testAllureReportWithRestAssured() {

        RequestSpecBuilder reqSpecBuilder = new RequestSpecBuilder();

        //To add Request and Response in Report Add this Filter.
        reqSpecBuilder.addFilter(new AllureRestAssured());
        RequestSpecification reqSpec =;


Step 3:

Below maven command is used to run the project it will create the allure-results folder in the configured destination.

clean install


 Below maven command is for after completion of the execution open browser and launch the report

clean install io.qameta.allure:allure-maven:serve

 Below maven command is to generate allure report under Project path\target\site\allure-maven-plugin

clean install io.qameta.allure:allure-maven:report


 Step 4:

Allure report will not open properly if we open index.html file from normal browser mode due to mordern browser restriction of external javascript execution from same origin.

So if we have a allure report which one previously generated then we need the following settings to open the report in browser.

chrome.exe --disable-web-security --user-data-dir=C:\Windows\Temp


chrome.exe --allow-file-access-from-files

Step 5:

All the below commands executed after navigated to project directory\.allure\allure-2.13.9\bin in cmd and then use.

else we can download the allure command line from here and execute the below command from bin directory.

To generate report manually from cmd we need to use the below command

allure generate -c <path of allure result folder>  -o <path of allure report folder>

If already report generate and need to open in browser then need to execute the below command

allure open <path of allure report folder>

If directly open the report from allure result then need to use the below command

allure serve  <path of allure result folder>

Step 6:

Report Dashboard

Report generated with attachment of request and response details.