Java 类org.testng.IHookCallBack 实例源码

项目:teasy    文件:AbstractSeleniumTest.java   
@Override
public void run(IHookCallBack callBack, ITestResult testResult) {
    super.run(callBack, testResult);
    if (testResult.getThrowable() != null) {
        try {
            final Throwable testResultThrowable = testResult.getThrowable();
            String message = testResultThrowable.getMessage() != null ? testResultThrowable.getMessage() :
                    testResultThrowable.getCause().getMessage();

            if (message == null) {
                message = "Test failed";
            }

            new Screenshoter().takeScreenshot(message, TestUtils.getTestName(testResult));
        } catch (Exception e) {
            log("Couldn't take screenshot. Error: " + e.getMessage());
        }
    }
}
项目:zeratul    文件:AbstractDubbo.java   
/**
 * 测试方法拦截器、所有测试方法在执行开始、执行中、执行完成都会在此方法中完成
 * @param callBack
 * @param testResult
 */
@Override
public void run(IHookCallBack callBack, ITestResult testResult) {
    // 如果测试方法上有@Ignore注解,则跳过测试框架直接执行测试方法
    if (isIgnoreAnnotation(getTestMethod(testResult))) {
        callBack.runTestMethod(testResult);
    }
}
项目:zeratul    文件:AbstractDubbo.java   
@SuppressWarnings("unchecked")
private void prepareTest(IHookCallBack callBack, ITestResult testResult) {
    Optional<Map<String, Object>> paramOptional = ofNullable(getParameters(testResult));
    Map<String, Object> param;
    if (paramOptional.isPresent()) {
        param = paramOptional.get();
    } else {
        throw new ParameterException("---------------获取测试入参失败!---------------");
    }
    Class<T> clazz = (Class<T>) getInterfaceClass(this);
}
项目:spring4-understanding    文件:AbstractTestNGSpringContextTests.java   
/**
 * 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;
}
项目:engerek    文件:AbstractConfiguredModelIntegrationTest.java   
@Override
public void run(IHookCallBack callBack, ITestResult testResult) {
    long time = System.currentTimeMillis();
    LOGGER.info("###>>> run start");
    super.run(callBack, testResult);
    LOGGER.info("###>>> run end ({}ms)", new Object[]{(System.currentTimeMillis() - time)});
}
项目:dagger-testng    文件:DaggerTestNGListener.java   
@Override
public void run(final IHookCallBack callBack,
                final ITestResult testResult) {

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

    callBack.runTestMethod(testResult);
}
项目:midpoint    文件:AbstractConfiguredModelIntegrationTest.java   
@Override
public void run(IHookCallBack callBack, ITestResult testResult) {
    long time = System.currentTimeMillis();
    LOGGER.info("###>>> run start");
    super.run(callBack, testResult);
    LOGGER.info("###>>> run end ({}ms)", new Object[]{(System.currentTimeMillis() - time)});
}
项目:class-guard    文件:AbstractTestNGSpringContextTests.java   
/**
 * 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)
 */
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;
}
项目:testng_samples    文件:RunTwiceInterceptor.java   
@Override
public void run(IHookCallBack callback, ITestResult res) {
  System.out.println("Starting " +  res.getName());
  callback.runTestMethod(res);
  if (res.getThrowable() != null) {
    res.setThrowable(null);
    System.out.println("Second attempt " +  res.getName());
    callback.runTestMethod(res);
  }
}
项目:midpoint    文件:AbstractConfiguredModelIntegrationTest.java   
@Override
public void run(IHookCallBack callBack, ITestResult testResult) {
    long time = System.currentTimeMillis();
    LOGGER.info("###>>> run start");
    super.run(callBack, testResult);
    LOGGER.info("###>>> run end ({}ms)", new Object[]{(System.currentTimeMillis() - time)});
}
项目:ctsms    文件:ServiceTestBase.java   
public void run(IHookCallBack hookCallBack) {
}
项目:ctsms    文件:DaoTestBase.java   
public void run(IHookCallBack hookCallBack) {
}
项目:spring4-understanding    文件:ProgrammaticTxMgmtTestNGTests.java   
@Override
public void run(IHookCallBack callBack, ITestResult testResult) {
    this.method = testResult.getMethod().getMethodName();
    super.run(callBack, testResult);
}
项目:aerial    文件:AerialTestNGRunner.java   
@Override
public void run(IHookCallBack iHookCallBack,
        ITestResult iTestResult) {
    super.run(iHookCallBack, iTestResult);
}
项目:test-libraries-for-java    文件:TearDownTestCase.java   
@Override
public void run(IHookCallBack iHookCallBack, ITestResult iTestResult) {
  iHookCallBack.runTestMethod(iTestResult);
  this.tearDownStack.runTearDown();
}
项目:zeratul    文件:AbstractHttp.java   
@Override
public void run(IHookCallBack callBack, ITestResult testResult) {

}