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

xMatters delivers integration-driven collaboration that relays data between systems, while engaging the right people to proactively resolve issues. Read the Monitoring in a Connected Enterprise whitepaper and learn about 3 tools for resolving incidents quickly.

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.

Discovering, responding to, and resolving incidents is a complex endeavor. Read this narrative to learn how you can do it quickly and effectively by connecting AppDynamics, Moogsoft and xMatters to create a monitoring toolchain.

testng ,allure ,performance ,tutorial ,test automation

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}