How to generate test report in IntelliJ IDE?


TestNG allows to run the test suites from IntelliJ IDE as well as command line. When user run the testing.xml either from IDE or command line, TestNG generates a default report. It saves all reports and respective html files in Project −> test−output folder. If folder is not present, TestNG creates the folder.

Enable the Report Generation

  • While running the testing.xml from IDE, user has to enable the default reports generation at Add Configuration −> Listeners tab.

Following screenshot shows how to enable default report generation in IntelliJ.

  • If user wants to generate report at customized path instead of default path, user should provide the path at Add Configuration −> Output directory.

  • User can even browse the path by clicking on folder icon present at right side in the same text box.

Following screenshot displays where to provide the path to enable the customized path for report creation:

Report Walkthrough

  • For default report generation, once run is completed, user can see the report at default location Project −> test−output.

Following screenshot displays the IDE path where reports can be seen:

  • The main consolidate report can be seen by opening the index.html. the view of this file is as shown in following screenshot:

  • In the left side, inside Info section, by clicking on 1st link (C:\Users\ananadas\.....testng.xml), user can see the details of executed testing.xml file.

  • Similarly, other links provide number of test suits, classes, groups, Ignored methods etc.

  • In the Results section, user can see how many @Test methods are executed and what are the status of each @Test method.

  • Apart from this, TestNG generates emailable−report.html file. It consists of consolidated reports and can be sent in email.

Following screenshot shows the view of this report:

  • Other than HTML reports, TestNG generates xml as well as junit reports.

  • Junit reports are xml reports and can be view in junitreports folder while testing−results.xml is present in main folder itself i.e. inside test−report.

Updated on: 17-Aug-2023

430 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements