Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I am using TestNG IRetryAnalyser and I am facing the following issues:

When I implement the listener and override the retry() method, Ì get the following error:

Listener com.socialtwist.taf.testnghelpers.RetryAnalyzer@1cc0a7f must be one of ITestListener, ISuiteListener, IReporter,  IAnnotationTransformer, IMethodInterceptor or IInvokedMethodListener
Usage: <main class> [options]

The following is the listener code:

public class RetryAnalyzer implements IRetryAnalyzer {
  private int count = 0; 
  private int maxCount = 3; 
  protected Logger log;
  private static Logger testbaseLog;

  static {    
    testbaseLog = Logger.getLogger("testbase.testng");
  }

  public RetryAnalyzer()
  {
    testbaseLog.trace( " ModeledRetryAnalyzer constructor " + this.getClass().getName() );
  }

  @Override 
  public boolean retry(ITestResult result) { 
    testbaseLog.trace("running retry logic for  '" 
            + result.getName() 
            + "' on class " + this.getClass().getName()
            + " with status " + result.getStatus()+"Retrying "+count+"times" );
    if(count < maxCount) {                     
       count++;                                    
       return true; 
    }
    return false; 
  }
}

The following is my test class:

public class Testing {
  @Test(retryAnalyzer=RetryAnalyzer.class)
  public void testMethod1() {
    System.out.println("in method1 " );
    Assert.fail();
  }
}

I am using TestNG 6.3.1.jar.

share|improve this question
1  
Your listener lass is named RetryAnalyzer, and yet in your test class, you refer to Analyzer.class. What is the Analyzer class? –  user246 Nov 6 '12 at 15:57
    
its type mistake, its RetryAnalyzer.clss –  saikrishna Nov 7 '12 at 6:57
    
Can you try with the latest testNG version. –  Mrunal Gosar 19 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.