コード例 #1
0
 @Override
 public void testStarted(WikiTestPage test) {
   String pageName = test.getFullPath();
   testHistoryFormatter = new TestXmlFormatter(context, test.getSourcePage(), writerFactory);
   testHistoryFormatter.testStarted(test);
   referenceToCurrentTest =
       new SuiteExecutionReport.PageHistoryReference(pageName, testHistoryFormatter.startedAt());
 }
コード例 #2
0
 @Override
 public void testComplete(WikiTestPage test, TestSummary testSummary) throws IOException {
   testHistoryFormatter.testComplete(test, testSummary);
   testHistoryFormatter.close();
   referenceToCurrentTest.setTestSummary(testSummary);
   referenceToCurrentTest.setRunTimeInMillis(testHistoryFormatter.runTime());
   suiteExecutionReport.addPageHistoryReference(referenceToCurrentTest);
   suiteExecutionReport.tallyPageCounts(
       ExecutionResult.getExecutionResult(test.getName(), testSummary));
   testHistoryFormatter = null;
   super.testComplete(test, testSummary);
 }
コード例 #3
0
 @Override
 public void errorOccurred(Throwable cause) {
   if (testHistoryFormatter != null) {
     testHistoryFormatter.errorOccurred(cause);
   }
   super.errorOccurred(cause);
 }
コード例 #4
0
  @Override
  public void close() throws IOException {
    if (suiteTime == null || suiteTime.isStopped()) return;
    suiteTime.stop();
    totalTimeMeasurement.stop();

    suiteExecutionReport.setTotalRunTimeInMillis(totalTimeMeasurement);

    if (testHistoryFormatter != null) {
      testHistoryFormatter.close();
    }

    if (PageType.fromWikiPage(getPage()) == PageType.SUITE) {
      Writer writer =
          writerFactory.getWriter(context, getPage(), getPageCounts(), suiteTime.startedAt());
      try {
        VelocityContext velocityContext = new VelocityContext();
        velocityContext.put("suiteExecutionReport", getSuiteExecutionReport());
        VelocityEngine velocityEngine = context.pageFactory.getVelocityEngine();
        Template template = velocityEngine.getTemplate("suiteHistoryXML.vm");
        template.merge(velocityContext, writer);
      } finally {
        writer.close();
      }
    }
  }
コード例 #5
0
 @Override
 public void testExceptionOccurred(Assertion assertion, ExceptionResult exceptionResult) {
   testHistoryFormatter.testExceptionOccurred(assertion, exceptionResult);
   super.testExceptionOccurred(assertion, exceptionResult);
 }
コード例 #6
0
 @Override
 public void testAssertionVerified(Assertion assertion, TestResult testResult) {
   testHistoryFormatter.testAssertionVerified(assertion, testResult);
   super.testAssertionVerified(assertion, testResult);
 }
コード例 #7
0
 @Override
 public void testOutputChunk(String output) {
   if (testHistoryFormatter != null) {
     testHistoryFormatter.testOutputChunk(output);
   }
 }