title: Re-Running TestNG tests not working for all the Tests
body: <p>I am using <strong>IRetryAnalyzer</strong> interface to run failed test cases again. It works fine if I have only one Test in my TestNG XML file, however if I have multiple tests in my XML file it works only for the first test. </p>
  
  <p><strong>Root Cause</strong>: the retryCount for second test is set to 1, I am not sure how to reset it. </p>
  
  <p><strong>Existing open issue</strong>: 
  <a href="https://github.com/cbeust/testng/issues/1241" rel="nofollow noreferrer">https://github.com/cbeust/testng/issues/1241</a></p>
  
  <p><strong>RetryAnalyzer.java</strong></p>
  
  <pre><code>public class RetryAnalyzer implements IRetryAnalyzer {
  
      private int retryCount = 0;
      private int maxRetryCount = 1;
  
      public boolean retry(ITestResult result) {
          if (retryCount &lt; maxRetryCount) {
              retryCount++;
              return true;
          }
          return false;
      }
  
  }
  </code></pre>
  
  <p><strong>AnnotationTransformer.java</strong></p>
  
  <pre><code>public class AnnotationTransformer implements IAnnotationTransformer {
  
       public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) {
           annotation.setRetryAnalyzer(RetryAnalyzer.class); //to enable for all the methods.
      }
  }
  </code></pre>
  
  <p><strong>TestNG.xml</strong> </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"&gt;
  &lt;suite name="BrowserStack" &gt;
  
      &lt;listeners&gt;
          &lt;listener class-name="uk.co.gaurang.libs.ResultListener" /&gt;
          &lt;listener class-name="uk.co.gaurang.libs.AnnotationTransformer" /&gt;
  
      &lt;/listeners&gt;
  
      &lt;test name="IPhone6S"&gt;
          &lt;classes&gt;
              &lt;class name="uk.co.gaurang.tests.Demo"/&gt;
          &lt;/classes&gt;
      &lt;/test&gt;
  
      &lt;test name="IPhone6SPlus"&gt;
          &lt;classes&gt;
              &lt;class name="uk.co.gaurang.tests.Demo"/&gt;
          &lt;/classes&gt;
      &lt;/test&gt;
  &lt;/suite&gt;
  </code></pre>