@Override public void completed(Object testId, TestCompleteEvent event) { if (testId.equals(rootId)) { //when root suite is completed we stop redirecting try { outputRedirector.stopRedirecting(); } finally { rootId = null; } } else { //when test is completed we should redirect output for the parent //so that log events emitted during @AfterSuite, @AfterClass are processed Object newOwner = parents.remove(testId); outputRedirector.setOutputOwner(newOwner); } processor.completed(testId, event); }
@Override public void completed(TestDescriptorInternal test, TestResult result, TestCompleteEvent completeEvent) { if (test.isComposite()) { testListener.afterSuite(test, result); } else { testListener.afterTest(test, result); } }
public void completed(TestCompleteEvent event) { this.completeEvent = event; resultType = isFailed() ? TestResult.ResultType.FAILURE : event.getResultType() != null ? event.getResultType() : TestResult.ResultType.SUCCESS; if (!test.isComposite()) { testCount = 1; switch (resultType) { case SUCCESS: successfulCount = 1; break; case FAILURE: failedCount = 1; break; } } if (startEvent.getParentId() != null) { TestState parentState = executing.get(startEvent.getParentId()); if (parentState != null) { if (isFailed()) { parentState.failedChild = true; } parentState.testCount += testCount; parentState.successfulCount += successfulCount; parentState.failedCount += failedCount; } } }
@Override public void completed(TestDescriptorInternal testDescriptor, TestResult testResult, TestCompleteEvent completeEvent) { if (testDescriptor.getParent() == null) { resultCount = resultCount + testResult.getTestCount(); } if (!testDescriptor.isComposite() && testResult.getFailedTestCount() != 0) { failedTests.add(new FailedTest(testDescriptor.getName(), testDescriptor.getClassName(), getTaskPath(testDescriptor))); } }
private void handleEvent(Map<String, Object> event) { // Gradle seems to only allow two tiers of tests, so drop the roots if (event.get("parentId") == null) { return; } JovialTestDescriptor descriptor = descriptors.computeIfAbsent((String) event.get("uniqueId"), uniqueId -> { boolean container = (boolean) event.get("container"); JovialTestDescriptor parent = container ? null : descriptors.get((String) event.get("parentId")); return new JovialTestDescriptor(uniqueId, parent, (String) event.get("displayName"), container); }); switch ((String) event.get("type")) { case "dynamicTestRegistered": // do nothing, for now break; case "executionSkipped": testResultProcessor.completed(descriptor.getId(), new TestCompleteEvent(Instant.now().toEpochMilli(), TestResult.ResultType.SKIPPED)); break; case "executionStarted": testResultProcessor.started(descriptor, new TestStartEvent(Instant.now().toEpochMilli(), null)); break; case "executionFinished": boolean success = (boolean) event.get("success"); TestResult.ResultType result = success ? TestResult.ResultType.SUCCESS : TestResult.ResultType.FAILURE; Throwable cause = (Throwable) event.get("throwable"); if (cause != null) { testResultProcessor.failure(descriptor.getId(), cause); } testResultProcessor.completed(descriptor.getId(), new TestCompleteEvent(Instant.now().toEpochMilli(), result)); break; } }
@Override public void completed(TestDescriptorInternal testDescriptor, TestResult testResult, TestCompleteEvent completeEvent) { eventConsumer.dispatch(new DefaultTestFinishedProgressEvent(completeEvent.getEndTime(), adapt(testDescriptor), adapt(testResult))); }
@Override public void completed(Object o, TestCompleteEvent testCompleteEvent) { }
private static TestCompleteEvent completeEvent(ResultType resultType) { return new TestCompleteEvent(System.currentTimeMillis(), resultType); }
void completed(TestDescriptorInternal testDescriptor, TestResult testResult, TestCompleteEvent completeEvent);