Re-run only failed tests with TestNG


Below code explains how we can run tests which fails due to some errors. Tests will run till Max Retry Count is met.

 * @Author : Gaurav Khanna

package testNG;

import org.testng.Assert;
import org.testng.IRetryAnalyzer;
import org.testng.ITestResult;
import org.testng.annotations.Test;

public class RetryFailTestCases implements IRetryAnalyzer {
    private int retryCount = 0;
    private int maxRetryCount = 2;

    public boolean retry(ITestResult result) {

        if (retryCount < maxRetryCount) {
            return true;
        return false;

    @Test(retryAnalyzer = RetryFailTestCases.class)
    public void testGenX() {

        // ListenerTest fails for gaurav. This will run till retryCount <
        // maxRetryCount
        Assert.assertEquals("gaurav", "GauravFail");


Defect Triage

Defect triage is a process where in majority of the project stake holders to go though new, existing defects and decide on the action items.  During defect triage meeting are conducted weekly or bi weekly depending on the state of the project.

During defect triage, stake holders go through the following

- New defects that were logged after last defect triage meeting.  Assign or reject them based on the findings.
- Reassign defect(s) as needed.
- Review all open high severity and priority defects
- Discuss about defects that are in dispute between development and test teams.
- Finalize on priorities on upcoming defect fix and verification.