private void fireExecutionSkipped(TestDescriptor testDescriptor, String reason) { testRun.markSkipped(testDescriptor); listener.executionSkipped(testDescriptor, reason); }
listener.executionSkipped(descriptor, shouldRun.getReason().get()); return; listener.executionSkipped(descriptor, "No methods to run"); } else { includePatterns.addAll(methodIncludePatterns);
private void verifyRunOfSimpleExampleTests() { verify(eventRecorder).executionStarted(TestDescriptorMatchers.isClassDescriptorFor(SimpleExampleTests.class)); // SimpleExampleTests.failing() verify(eventRecorder).executionStarted(TestDescriptorMatchers.isPropertyDescriptorFor(SimpleExampleTests.class, "failing")); verify(eventRecorder).executionFinished( TestDescriptorMatchers.isPropertyDescriptorFor(SimpleExampleTests.class, "failing"), TestExecutionResultMatchers.isFailed() ); // SimpleExampleTests.succeeding() verify(eventRecorder).executionStarted(TestDescriptorMatchers.isPropertyDescriptorFor(SimpleExampleTests.class, "succeeding")); verify(eventRecorder).executionFinished( TestDescriptorMatchers.isPropertyDescriptorFor(SimpleExampleTests.class, "succeeding"), TestExecutionResultMatchers.isSuccessful() ); // SimpleExampleTests.withJupiterAnnotation() verify(eventRecorder).executionSkipped( TestDescriptorMatchers.isSkipDecoratorFor(SimpleExampleTests.class, "withJupiterAnnotation"), anyString() ); // SimpleExampleTests.staticExample() verify(eventRecorder).executionSkipped( TestDescriptorMatchers.isSkipDecoratorFor(SimpleExampleTests.class, "staticExample"), anyString() ); verify(eventRecorder).executionFinished( TestDescriptorMatchers.isClassDescriptorFor(SimpleExampleTests.class), TestExecutionResultMatchers.isSuccessful() ); }
private void reportCompletion() { if (throwableCollector.isEmpty() && skipResult.isSkipped()) { try { node.nodeSkipped(context, testDescriptor, skipResult); } catch (Throwable throwable) { BlacklistedExceptions.rethrowIfBlacklisted(throwable); logger.debug(throwable, () -> String.format("Failed to invoke nodeSkipped() on Node %s", testDescriptor.getUniqueId())); } taskContext.getListener().executionSkipped(testDescriptor, skipResult.getReason().orElse("<unknown>")); return; } if (!started) { // Call executionStarted first to comply with the contract of EngineExecutionListener. taskContext.getListener().executionStarted(testDescriptor); } try { node.nodeFinished(context, testDescriptor, throwableCollector.toTestExecutionResult()); } catch (Throwable throwable) { BlacklistedExceptions.rethrowIfBlacklisted(throwable); logger.debug(throwable, () -> String.format("Failed to invoke nodeFinished() on Node %s", testDescriptor.getUniqueId())); } taskContext.getListener().executionFinished(testDescriptor, throwableCollector.toTestExecutionResult()); throwableCollector = null; }
@Example void runDisabledTests() { LauncherDiscoveryRequest discoveryRequest = request().selectors(selectPackage("examples.packageWithDisabledTests")).build(); TestDescriptor engineDescriptor = runTests(discoveryRequest); verify(eventRecorder).executionStarted(engineDescriptor); // DisabledTests verify(eventRecorder).executionStarted(TestDescriptorMatchers.isClassDescriptorFor(DisabledTests.class)); verify(eventRecorder).executionStarted(TestDescriptorMatchers.isPropertyDescriptorFor(DisabledTests.class, "success")); verify(eventRecorder).executionFinished( TestDescriptorMatchers.isPropertyDescriptorFor(DisabledTests.class, "success"), TestExecutionResultMatchers.isSuccessful() ); verify(eventRecorder).executionSkipped( TestDescriptorMatchers.isPropertyDescriptorFor(DisabledTests.class, "disabledSuccess"), eq("a reason") ); verify(eventRecorder).executionSkipped( TestDescriptorMatchers.isPropertyDescriptorFor(DisabledTests.class, "disabledFailure"), startsWith("@Disabled:") ); verify(eventRecorder).executionSkipped( TestDescriptorMatchers.isClassDescriptorFor(DisabledTests.DisabledGroup.class), startsWith("@Disabled:") ); verify(eventRecorder).executionFinished( TestDescriptorMatchers.isClassDescriptorFor(DisabledTests.class), TestExecutionResultMatchers.isSuccessful() ); verify(eventRecorder).executionFinished(engineDescriptor, TestExecutionResult.successful()); }
public void execute(TestDescriptor testDescriptor, EngineExecutionListener listener) { JmhSupport support = new JmhSupport(); ChainedOptionsBuilder optionsBuilder = support.options(); List<AbstractBenchmarkDescriptor> methods = collectBenchmarkMethods(testDescriptor); List<AbstractBenchmarkDescriptor> includes = getIncludes(testDescriptor); if (!support.isEnabled()) { listener.executionSkipped(testDescriptor, "No benchmarks"); return; } List<String> includePatterns = evaluateBenchmarksToRun(includes, listener); if (!shouldRun(includePatterns)) { return; } includePatterns.forEach(optionsBuilder::include); CacheFunction cache = new CacheFunction(methods); Options options = optionsBuilder.build(); NotifyingOutputFormat notifyingOutputFormat = new NotifyingOutputFormat(listener, cache, support.createOutputFormat(options)); try { listener.executionStarted(testDescriptor); support.publishResults(notifyingOutputFormat, new Runner(options, notifyingOutputFormat).run()); listener.executionFinished(testDescriptor, TestExecutionResult.successful()); } catch (RunnerException e) { listener.executionFinished(testDescriptor, TestExecutionResult.failed(e)); } }