How to generate Allure reports with Screenshot in Selenium/JUnit 5 Project?

  1. Create a Maven project with JUnit5 and Selenium dependencies.
  2. Add allure reports dependencies in the pom.xml file

  1. Create a parent class and a method to execute after each test case . Add the below code to take a screenshot and attach it with the Allure report.

  1. After executing the test case, you can see a new folder “allure-results” is generated.

  2. now in the IDE terminal execute the command, "allure generate ".And you can see the index.html file along with other files also generated .

  3. Open the index.html file in the browser. You can see the report like this.

You can refer to this Github project.

1 Like