Over a million developers have joined DZone.

Test Automation: Reporting With TestNG and Allure

DZone's Guide to

Test Automation: Reporting With TestNG and Allure

Have a look at how to generate various test reports with open-source tools Allure and TestNG.

· Performance Zone ·
Free Resource

Built by operators for operators, the Sensu monitoring event pipeline empowers businesses to automate their monitoring workflows and gain deep visibility into their multi-cloud environments. Get started for free today.

TestNG is a testing framework that enables you to cover end-to-end, functional, integration, and other types of tests. Allure is an open-source framework designed to generate test reports in a convenient and clear form. Integrating TestNG and Allure, you'll optimize the reporting activities. Let's have a look how to do that.

Using the Gradle project, add the TestNG dependency and include the task for Allure report generation to build.gradle.

Add a simple assert, after which you’ll get a test with failed status:


After, you’ll get the following error message:



to contain:


Run  gradlew clean test and check the report in the folder /build/reports/tests:

Let’s have a look how checkings/errors are logged in Allure reports. Execute gradlew allureReport. The report is in the folder /build/reports/allure-report. Overview section represents one failed test:

Move to Categories. Opening all the sections, you can see that Product Defects represents a short error message about failed assert:

You can look through a full stack trace in the Suites section:

Instead of an assert, put:


After executing the command gradlew clean test allureReport =, you’ll get the report that includes successfully passed test:

The message "There are no items" appears in the Categories section.

So, AssertJ can work properly with TestNG as well as log tests and errors in Allure reports.

Download our guide to mitigating alert fatigue, with real-world tips on automating remediation and triage from an IT veteran.

testng ,allure ,performance ,tutorial ,test automation

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}