What is an Allure Report:
First let’s understand, what is an Allure Report.
It is a very flexible, easy to understand multilanguage reporting tool. It generates crisp clear, easy to understand graphical reports which are understandable by everyone.
its looks like this.
In this blog, I will explain how to generate Allure report in the maven Project, step by step.
1. Create a Maven Project and add required dependencies in the XML file.
A. For creating Maven project follow these steps.
· Click on file
· Select New
· Select Project
· Select Others.
· Select Maven
· Select Next
· Select “Create a simple Project”
· Type Name of your project in “Group Id” text box
· Type same name in “Artifact Id”
· Click finish.
You should see, created project in your Eclipse Home Page.
A. Add below dependencies in POM.XML file.
. Selenium Java Dependency
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
. TestNG Dependency
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
. Allure-TestNG Dependency
<!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-testng -->
Steps to add dependencies in POM.XML file are as follows…
· Now open POM.XML file. And copy above given dependencies and paste these dependencies under <dependencies> </dependencies> tag.
· Click on save button.
2. Download Maven & Allure Binaries than set environment path in your system.
A. For downloading maven for operating system and setting the path, here are the steps….
. Go to : https://maven.apache.org/download.cgi
. Click on “apache-maven-3.8.6-bin.zip”
· Extract the Zip File.
· Go to till the bin folder. And copy the path.
· Now go to your system Advanced setting by following this…
Right click on My computer →Select Properties → select Advanced system Setting.
You Should see this window.
· Click on environment variable. Following window should popup.
· Select Edit in “System Variables”.
. In next window click “New” and paste the bin folder path here and click on “save” button.
· Now to check Maven version , type mvn -version command in Command Prompt.
B. Now download allure for operating system and set the path in system, we need to follow these steps.
· go to: https://docs.qameta.io/allure/
· select: 2.1. Installing a commandline.
· Click “Maven Central”.
. Click "2.10.00".
. After downloading the folder, extract the folder and go to till bin file and select path and paste this path to your system environment variable as we did for Maven in last step(A).
. To check, if allure downloaded successfully in your system, type allure --version in command prompt. You should see the version of Allure in command prompt.
3. Now go back to your maven project and create testcase and run through TestNG.XML by following these steps.
· Create a package under src\test\java.
Right Click on src\test\java→ select New → select Package → type name of package → click Finish.
Here I gave my package name as TestCase.
· Now Create class under your test package.
Right Click on TestPackage→ select New → select class → type name of class → click Finish.
I gave my class name as Test_001
· New class should be created.
· Now write your test case.
· Run your testcase.
Right click on this Test Case → select Run As→ select 1TestNGTest
· Refresh the project
Right click on the Project → select Refresh
· Now, there should be folder created under your Maven project with the name allure-results.
4. Now let’s generate allure report by following these steps.
· Right click on the folder allure-results, click Properties.
· Copy folder Path.
5. Open command Prompt.
6. Type command allure serve and paste the path of the allure result folder. Press Enter.
7.It will take few seconds to generate the allure report.
8. Now you can see allure report.