enter image description here

I have generated a test suite and run the testng.xml file and default report is generated accordingly.

I want to modify default generated report. I want to display one column which shows the pass and fail result for each testcase. How do I go about this?


There are several customized report tools available in market. Also you can use some API like ExtentReport which is also useful and most of the functionality is given by default.

Lets come to question, Please refer this link. Here you can add some lines of java code to add or remove the result of TestNG report.

As per my practical example TestNG by default shows parameter as given in email-able Html report. I have run project from testng.xml Here file is attached.

enter image description here

As you want to print whole data regarding the actions and inputs, You can also use Log4J. It would create separate file for logging this type of details with larger configuration.

| improve this answer | |
  • Hello I want to change only parameter name which is display by default. i have try to change from html file but did not change – Rutvi Soni Dec 12 '16 at 11:22
  • Let me see further. – Sagar007 Dec 12 '16 at 11:26
  • What is parameter name is here? – Sagar007 Dec 12 '16 at 11:26
  • Here I want to change parameter#1 to username . – Rutvi Soni Dec 12 '16 at 11:30
  • Hi I had run project with parameter and it is running fine and shows parameter name. Can you please tell from where you run testng ? from textng.xml or from direct class? – Sagar007 Dec 12 '16 at 12:56

In package explorer->test-output->right click on emailable-report.html file and open with texteditor. change name by default(Parameter#1) to "Name"

| improve this answer | |
  • Please check after re-run of project. – Sagar007 Dec 13 '16 at 8:04
  • I have check it's display correct – Rutvi Soni Dec 13 '16 at 8:10
  • Please re-run project with testng.xml and refresh folder. After that open the file from test-output folder. I am not able to find parameter name as you say. – Sagar007 Dec 13 '16 at 8:12
  • ya that's right.i have also check after open file from test-output it's change – Rutvi Soni Dec 13 '16 at 8:35
  • Because every testng run the folder files get refreshed and reload as previous default configuration. So this is not appropriate way to do so. – Sagar007 Dec 13 '16 at 8:36

you should be able to override the report creation by creating your own implementation of IReporter interface:

import java.util.List;
import java.util.Map;

import org.testng.IReporter;
import org.testng.ISuite;
import org.testng.ISuiteResult;
import org.testng.ITestContext;
import org.testng.xml.XmlSuite;

public class CustomReporter implements IReporter{
    public void generateReport(List xmlSuites, List suites,
        String outputDirectory) {
        // Iterating over each suite included in the test
        for (ISuite suite : suites) {
            // Following code gets the suite name
            String suiteName = suite.getName();
        // Getting the results for the said suite
        Map suiteResults = suite.getResults();
        for (ISuiteResult sr : suiteResults.values()) {
            ITestContext tc = sr.getTestContext();
            System.out.println("Passed tests for suite '" + suiteName +
                 "' is:" + tc.getPassedTests().getAllResults().size());
            System.out.println("Failed tests for suite '" + suiteName +
                 "' is:" + tc.getFailedTests().getAllResults().size());
            System.out.println("Skipped tests for suite '" + suiteName +
                 "' is:" + tc.getSkippedTests().getAllResults().size());
| improve this answer | |

Try working with the surefire plugin. This is a better option which works fine with TestNG. Also easy to integrate with Jenkins.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.