@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()); }
@Override public void testStarted(WikiTestPage test) { firstFailure = null; if (test.isTestPage()) { notifier.fireTestStarted(descriptionFor(test)); } }
@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); }
@Override public void testComplete(WikiTestPage test, TestSummary testSummary) { increaseCompletedTests(); if (firstFailure != null) { notifier.fireTestFailure(new Failure(descriptionFor(test), firstFailure)); } else if (test.isTestPage()) { if (testSummary.getExceptions() > 0) { notifier.fireTestFailure( new Failure( descriptionFor(test), new Exception("Exception occurred on page " + test.getFullPath()))); } else if (testSummary.getWrong() > 0) { notifier.fireTestFailure( new Failure( descriptionFor(test), new AssertionError("Test failures occurred on page " + test.getFullPath()))); } else { notifier.fireTestFinished(descriptionFor(test)); } } }
private Description descriptionFor(WikiTestPage test) { return Description.createTestDescription(mainClass, test.getFullPath()); }