HomeJunit 5Junit 5 with allure reports example

Junit 5 with allure reports example

Allure is an open-source framework designed to create test execution reports. In this article you will see a java maven project that integrating Junit 5 with allure and how to generate some cool reports by executing test cases.

Technologies used in following examples :

  1. Junit 5.5.2
  2. Maven 3
  3. Java 8
  4. Spring Tool Suite 3.9.8
  5. allure 2.13.0
  6. aspectjweaver 1.9.4

Project Structure :

Junit 5 allure reports example

1. Maven configuration for Allure and JUnit 5

pom.xml :

You need to configure allure-maven plugin and allure-junit5 dependency in pom.xml . Following is the maven dependency and plugin configuration in pom.xml for the Junit 5 with allure example.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">



        <!-- Test API(s) -->
        <!-- Parameterized Tests -->
        <!-- Test engine(s) -->

            <!-- Maven plugin to use perticular java version to compile code -->

2. Writing Junit 5 tests

In this example I have used only Junit 5 specific annotations to create tests, you can use allure annotations as well, like @Step and @Description etc. To demonstrate test reports I have created couple of Junit 5 test cases in this example such as Timeout Tests, Parameterized tests, Repeated tests, Tag based tests and Display names tests.

You will see all the tests cases from our git hub repository, you will find repository url end of this article.

3. Running Junit 5 tests and generating allure reports

Allure results will appear in allure-results folder under the project root. To generate html report and automatically open it in a web browser, run the following command:

Navigate to project root directory and issue following command to run junit 5 tests and report.

$ mvn clean test allure:report

Run the following command to open the generated reports in browser.

$mvn allure:serve

3.1. Generated Reports :

The allure generated reports looks like in the following image.

3.2. Filter and Run tag-specific test cases and generate allure report :

You run the following command to run only test cases based on tags.

$ mvn clean test -Dgroups="api | performance" allure:report

There are 2 api tests and 1 performance test in application, the following image shows you the allure report results.

Junit 5 with allure filter and tag specific tests

4. Conclusion

In this article we have covered Junit 5 with allure integration using maven and generating and open results for several use cases.

You can download source code from our github repository.

You also might be interested in following examples:

  1. Junit 5 Dynamic Tests
  2. Junit 5 tags and filter
  3. Junit 5 Timeout tests
  4. Junit 5 Repeated tests
  5. Junit 5 parallel execution
  6. Junit 5 – ParameterResolver
  7. Junit 5 @TestInstance
  8. Junit 5 test order

5. References

  1. Allure document
  2. Junit 5 maven example
  3. Junit 5 tags and filter tests for execution


  1. Superb! You rocks! You really helped me to set up pom file! Just want to add that a new version of Aspectj for some reason doesn’t work: 1.9.5 – it give an error: Dependency ‘org.aspectj:aspectjweaver:1.9.5’ not found, however I can find it – but it is not related with your article – just for extra information

  2. This is pretty simple and thanks for the documentation.

    Is there any possiblity to log the api request and response in allure report (Junit5).?


Please enter your comment!
Please enter your name here