Tuesday, October 20, 2020

Steps to implement Allure Reporting in Selenium java

 Hey Guys,

Steps to implement Allure reporting in selenium java framework.

Allure is an open-source framework designed to create interactive and comprehensive test report.

Each time when we run automation tests, we will have test results to view details about no. of tests passed, failed and failure details etc. And few reports also include test failure screenshots.

Allure report works

When we run our tests, every popular test framework generates junit-style xml report which will be used by Allure to generate HTML report. Allure reports has provided adapters for Java, PHP, Ruby, Python, Scala and C# test frameworks.

Steps to Generate Allure Reports

Install and configuration

  • Install Allure report command line application
  • do this manually by downloading the latest version as a zip archive from bintray.
    • Unpack the archive to allure-command line directory
    • Navigate to bin directory
    • Add allure to system PATH.

Implementation in code

  •            Create Maven project
  •             Add allure maven dependencies in pom.xml file and also add  AspectJ Weaver dependency along with allure.
  •             Create two test file in src/test/java folder and append the allure features in it for writing reports
  •             Create Testng.xml file
  •             We can add environment details in allure report by adding following
      •   Environment.properties
      •   Environment.xml
  •              We can categories the failed cases/defects using categories.json file
  • append the features of allure report to code like @step, @feature etc

 Run the code and generate the allure report

  •  Go to command prompt and in project directory and run the command
    • Mvn clean test
  • Or run the code through eclipse/intelij
  • Go to command prompt and generate the allure report in temporary folder using command
    • Allure serve <path of allure report>  (Generate report in temporary folder)
    • Allure generate <path of allure report> (Generate report in c:/user directory with allure folder)
    • Allure open <path of allure report>
    • Allure generate <path of allure report> --clean (will overwrite the existing report)

You can find more information on Allure documentation.

 Cheers.

TJ

1 comment:

  1. Great job buddy,

    Selenium testing tool is a lightweight tool and is developer-friendly, commonly used for automating web applications.

    Test automation using selenium webdriver with java, automation testing can be used in any operating system environment such as Windows, Linux, and OS X and has been first developed by Jason Huggins in the year 2004.

    Cross-browser testing in selenium is an effective selenium testing method used by testers and this tool is also used for web application testing. This selenium testing tool is composed of several components that provide different features.

    ReplyDelete