public void afterInvocation(IInvokedMethod method, ITestResult result) {
    resultT = result;
    String textMsg = "Completed executing " + returnMethodName(method.getTestMethod());
    Reporter.log(textMsg, true);

    Reporter.setCurrentTestResult(result);

    if (method.isTestMethod()) {

      List<Throwable> verificationFailures = TestBase.getVerificationFailures();

      // if there are verification failures...
      if (verificationFailures.size() > 0) {

        // set the test to failed
        result.setStatus(ITestResult.FAILURE);

        // if there is an assertion failure add it to verificationFailures
        if (result.getThrowable() != null) {
          verificationFailures.add(result.getThrowable());
        }

        int size = verificationFailures.size();
        // if there's only one failure just set that
        if (size == 1) {
          result.setThrowable(verificationFailures.get(0));
        } else {
          // create a failure message with all failures and stack traces (except last failure)
          StringBuffer failureMessage =
              new StringBuffer("Multiple failures (").append(size).append("):\n\n");
          for (int i = 0; i < size - 1; i++) {
            failureMessage
                .append("Failure ")
                .append(i + 1)
                .append(" of ")
                .append(size)
                .append(":\n");
            Throwable t = verificationFailures.get(i);
            String fullStackTrace = Utils.stackTrace(t, false)[1];
            failureMessage.append(fullStackTrace).append("\n\n");
          }

          // final failure
          Throwable last = verificationFailures.get(size - 1);
          failureMessage.append("Failure ").append(size).append(" of ").append(size).append(":\n");
          failureMessage.append(last.toString());

          // set merged throwable
          Throwable merged = new Throwable(failureMessage.toString());
          merged.setStackTrace(last.getStackTrace());

          result.setThrowable(merged);
        }
      }
    }
  }
  @Override
  public void result(Result result) {
    // addTestNgAttribute(RESULTS, result);
    String timing =
        result.getDuration() != null
            ? " : " + (Math.round(result.getDuration() / 1000000000f * 100f) / 100f) + "s"
            : "";
    Step step;
    if (steps.isEmpty()) {
      step = new Step(null, "MISMATCH BETWEEN STEPS AND RESULTS", "", 0, null, null);
    } else {
      step = steps.pop();
    }
    org.testng.Reporter.log(
        "<div class=\"result\">"
            + step.getKeyword()
            + " "
            + step.getName()
            + " ("
            + result.getStatus()
            + timing
            + ")</div>");

    if (Result.FAILED.equals(result)) {
      ITestResult tr = org.testng.Reporter.getCurrentTestResult();
      tr.setThrowable(result.getError());
      tr.setStatus(ITestResult.FAILURE);
      failureCount.incrementAndGet();
    } else if (Result.SKIPPED.equals(result)) {
      ITestResult tr = org.testng.Reporter.getCurrentTestResult();
      tr.setThrowable(result.getError());
      tr.setStatus(ITestResult.SKIP);
      skipCount.incrementAndGet();
    } else if (Result.UNDEFINED.equals(result)) {
      ITestResult tr = org.testng.Reporter.getCurrentTestResult();
      tr.setThrowable(result.getError());
      tr.setStatus(ITestResult.FAILURE);
      failureCount.incrementAndGet();
    } else {
      passCount.incrementAndGet();
    }
  }
  @Override
  public void run(final IConfigureCallBack callBack, final ITestResult testResult) {

    try {
      injectTestResult(testResult);
    } catch (ReflectiveOperationException roe) {
      testResult.setThrowable(roe);
      return;
    }

    callBack.runConfigurationMethod(testResult);
  }
 @Override
 public void onTestSkipped(ITestResult result) {
   if (result
       .getMethod()
       .getConstructorOrMethod()
       .getMethod()
       .isAnnotationPresent(DontRun.class)) {
     log("Test SKIPPED", "this test is not supported in this environment", true);
     result.setStatus(ITestResult.SUCCESS);
     onTestSuccess(result);
   } else {
     result.setStatus(ITestResult.FAILURE);
     result.setThrowable(new SkipException("TEST SKIPPED"));
     onTestFailure(result);
   }
 }