/**
   * Delegates to the {@link IHookCallBack#runTestMethod(ITestResult) test method} in the supplied
   * {@code callback} to execute the actual test and then tracks the exception thrown during test
   * execution, if any.
   *
   * @see org.testng.IHookable#run(org.testng.IHookCallBack, org.testng.ITestResult)
   */
  @Override
  public void run(IHookCallBack callBack, ITestResult testResult) {
    callBack.runTestMethod(testResult);

    Throwable testResultException = testResult.getThrowable();
    if (testResultException instanceof InvocationTargetException) {
      testResultException = ((InvocationTargetException) testResultException).getCause();
    }
    this.testException = testResultException;
  }
  @Override
  public void run(final IHookCallBack callBack, final ITestResult testResult) {

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

    callBack.runTestMethod(testResult);
  }
示例#3
0
 @Override
 public void run(IHookCallBack callBack, ITestResult testResult) {
   if (!("dontChangeName".equals(testResult.getMethod().getMethodName()))) {
     Object param = "999";
     Object[] parameters = callBack.getParameters();
     if (parameters.length != 0) {
       param = parameters[0];
     }
     String testName = name(testResult.getMethod().getMethodName(), param);
     if (testResult instanceof IAlterTestName) {
       ((IAlterTestName) testResult).setTestName(testName);
     }
   }
   callBack.runTestMethod(testResult);
 }
 // Makes sure TestNG integration works with test classes which implement IHookable.
 public void run(IHookCallBack callBack, ITestResult testResult) {
   callBack.runTestMethod(testResult);
 }