title: Retry mechanism in karate testing framework
body: <p>Retry mechanism in karate testing framework How to retry tests on failure in karate testing framework like Junit and TestNG.
  something like 
  public class Retry implements IRetryAnalyzer {</p>
  
  <pre><code>private int count = 0;
  private static int maxTry = 3;
  
  @Override
  public boolean retry(ITestResult iTestResult) {
      if (!iTestResult.isSuccess()) {                      //Check if test not succeed
          if (count &lt; maxTry) {                            //Check if maxtry count is reached
              count++;                                     //Increase the maxTry count by 1
              iTestResult.setStatus(ITestResult.FAILURE);  //Mark test as failed
              return true;                                 //Tells TestNG to re-run the test
          } else {
              iTestResult.setStatus(ITestResult.FAILURE);  //If maxCount reached,test marked as failed
          }
      } else {
          iTestResult.setStatus(ITestResult.SUCCESS);      //If test passes, TestNG marks it as passed
      }
      return false;
  }
  </code></pre>
  
  <p>}</p>