コード例 #1
0
  @Override
  public void doExecute(TestContext context) {
    boolean success = true;

    testSuiteListener.onFinish();

    log.info("Executing " + actions.size() + " actions after suite");
    log.info("");

    for (TestAction action : actions) {
      try {
        /* Executing test action and validate its success */
        action.execute(context);
      } catch (Exception e) {
        log.error("After suite action failed " + action.getName() + "Nested exception is: ", e);
        log.error("Continue after suite actions");
        success = false;
      }
    }

    if (success) {
      testSuiteListener.onFinishSuccess();
    } else {
      testSuiteListener.onFinishFailure(new CitrusRuntimeException("Error in after suite"));
      throw new CitrusRuntimeException("Error in after suite");
    }
  }
コード例 #2
0
 public void run() {
   if (afterSuite != null) {
     try {
       afterSuite.execute(context);
     } catch (Exception e) {
       throw new CitrusRuntimeException("After suite failed with errors", e);
     }
   } else {
     testSuiteListener.onFinish();
     testSuiteListener.onFinishSuccess();
   }
 }