@Override public void started(final TestDescriptorInternal test, TestStartEvent event) { processor.started(test, event); outputRedirector.setOutputOwner(test.getId()); if (rootId == null) { outputRedirector.startRedirecting(); rootId = test.getId(); } else { Object parentId = event.getParentId(); if (parentId == null) { //if we don't know the parent we will use the top suite //this way we always have and id to attach logging events for parentId = rootId; } parents.put(test.getId(), parentId); } }
@Override public void started(TestDescriptorInternal test, TestStartEvent startEvent) { if (test.isComposite()) { testListener.beforeSuite(test); } else { testListener.beforeTest(test); } }
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; } }
public TestState(TestDescriptorInternal test, TestStartEvent startEvent, Map<Object, TestState> executing) { this.test = test; this.startEvent = startEvent; this.executing = executing; }
@Override public void started(TestDescriptorInternal testDescriptor, TestStartEvent startEvent) { eventConsumer.dispatch(new DefaultTestStartedProgressEvent(startEvent.getStartTime(), adapt(testDescriptor))); }
@Override public void started(TestDescriptorInternal testDescriptorInternal, TestStartEvent testStartEvent) { }
private static TestStartEvent startEvent() { return new TestStartEvent(System.currentTimeMillis()); }
private static TestStartEvent startEvent(TestDescriptorInternal parent) { return new TestStartEvent(System.currentTimeMillis(), parent.getId()); }
@Override public void started(TestDescriptorInternal testDescriptor, TestStartEvent startEvent) { }
void started(TestDescriptorInternal testDescriptor, TestStartEvent startEvent);