Hi everyone. Welcome to my first blog. Here I am going to tell you how to generate the allure reports for the test case execution.
What is Allure:
Allure is an open source framework that is open source designed to create interactive and comprehensive test report by Yandex QA Team.
When we run automation tests, we get test results to view about number of tests performed, passed, failed and failure details.
Here are the steps to start a project:
First, I created a simple maven project in eclipse
Then clicked Next, Next and give the Group Id and Artifact Id and clicked finish.
Then, I added all the required dependencies in pom.xml. Here are the list of dependencies I added:
TestNG dependency.
Selenium java dependency
Allure TestNG dependency
Webdrivermanager dependency
I took all the above dependencies from https://mvnrepository.com/
The next step was to download Maven and Allure binaries and set path
I opened https://maven.apache.org/download.cgi site and as I was working on windows operating system I downloaded .zip file.
Then I extracted the zip file and got the path for bin folder
Next, I added the copied path in Environment Variable setting and clicked ok.
Then I configured the maven from the command prompt by giving mvn -version
I followed the same procedure for Allure Binaries.
I opened the site https://qameta.io/allure-report/ and then I clicked Documentation.
Then, I clicked the latest version available and from there I downloaded the zip file. Here is the path for the zip file https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.10.0/
I extracted the zip file and copied the path from the bin folder.
Select the path variable from system variables and click on edit and then add the copied path and click ok.
Then go to command prompt and give the command as Allure --version to configure.
As of now I added all the dependencies in pom.xml and set the Maven and Allure binary paths.
Next, I created a simple project and I intentionally failed 1 test case and skipped 1 test case. Then I run the test as TestNG Test and got the output.
Then, I created one TestNG xml file by clicking right mouse button on my test case file and go TestNG and click Convert to TestNG and created testng.xml file inside my project.
I ran my test case through testng.xml file by clicking right mouse button on testng.xml and clicked on run as TestNG suite.
After running the test case successfully, refresh the project by clicking right mouse button on project and select refresh.
You can see a new folder after refreshing the project called 'allure-results' that is automatically generated.
By default allure results are formatted in JSON format, but we need to see the reports in html format.
To view the reports in html format, we have to run a specific command that is 'allure serve'. For that, first we need to capture the path of the allure results folder by clicking the right mouse button on allure results folder and then select the entire path of the allure results.
Ways to run the command to generate allure reports in html:
There are 2 ways we can run the command.
Go to command prompt and give 'allure serve' and paste the entire path you copied and click enter.
Click right mouse button on your project and select show in and select Terminal. you can see command prompt in eclipse itself. There type Allure serve and paste the path you copied before and click enter.
By running the Allure serve command with path, Allure reports will be automatically generated with all the test details including which are passed, failed and skipped.
CONCLUSION:
Allure is a multi-language test reporting tool that is designed for test execution reports that are easy to understand. It lets to add you parameters, steps, and attachments. It provides clear graphical reports and allows everyone involved in the development process to extract the maximum of information from the everyday testing process.
Σχόλια