/** * Instance an engine and execute the test resources identified by the given {@code selectors} and * wrap the response in a listener so that we can make sense of what happened. The listener * exposes information about the test execution flow which the extension tests can assert against. * * @param selectors {@link DiscoverySelector} instances which will isolate test class or test * methods * @return a {@link RecordingExecutionListener} which encapsulates what the engine did */ public static RecordingExecutionListener execute(DiscoverySelector... selectors) { // instance an engine JupiterTestEngine testEngine = new JupiterTestEngine(); // discover the requested test resources LauncherDiscoveryRequest discoveryRequest = request().selectors(selectors).build(); RecordingExecutionListener listener = new RecordingExecutionListener(); // execute the discovered test resources TestDescriptor testDescriptor = testEngine.discover(discoveryRequest, UniqueId.forEngine(testEngine.getId())); testEngine.execute( new ExecutionRequest( testDescriptor, listener, discoveryRequest.getConfigurationParameters())); return listener; }
public static void execute(Class<?> testClass) throws Exception { try { JupiterTestEngine engine = new JupiterTestEngine(); TestClassEngineDiscoveryRequest discoveryRequest = new TestClassEngineDiscoveryRequest(testClass); TestDescriptor testDescriptor = engine.discover(discoveryRequest, UniqueId.forEngine("foo-bar")); EngineExecutionListener listener = new NoOpEngineExecutionListener(); ConfigurationParameters parameters = new NoConfigurationParameters(); engine.execute(new ExecutionRequest(testDescriptor, listener, parameters)); } catch (UndeclaredThrowableException e) { Throwable cause = getFirstNonUndeclaredThrowableCause(e); if (cause instanceof Error) { throw ( Error ) cause; } else if (cause instanceof RuntimeException) { throw ( RuntimeException ) cause; } else if (cause instanceof Exception) { throw ( Exception ) cause; } else { throw e; } } }
@Override public void execute(ExecutionRequest request) { // Use ExecutionRequest to execute TestDescriptor TestDescriptor rootTestDescriptor = request.getRootTestDescriptor(); request.getEngineExecutionListener() .executionStarted(rootTestDescriptor); }
private JupiterExecutionListener executeTests(LauncherDiscoveryRequest request) throws Exception { TestDescriptor testDescriptor = createTestDescriptorForCucumber( engine.discover(request, forEngine(engine.getId())), containers); eventRecorder.reset(); engine.execute(new ExecutionRequest(testDescriptor, eventRecorder, request.getConfigurationParameters())); return eventRecorder; }
public static List<ExecutionEvent> execute(TestEngine testEngine, EngineDiscoveryRequest discoveryRequest) { TestDescriptor engineTestDescriptor = testEngine.discover(discoveryRequest, UniqueId.forEngine(testEngine.getId())); ExecutionEventRecorder listener = new ExecutionEventRecorder(); testEngine.execute( new ExecutionRequest(engineTestDescriptor, listener, discoveryRequest.getConfigurationParameters())); return listener.getExecutionEvents(); }
@Override public void execute(ExecutionRequest request) { TestDescriptor engine = request.getRootTestDescriptor(); EngineExecutionListener listener = request.getEngineExecutionListener(); listener.executionStarted(engine); for (TestDescriptor child : engine.getChildren()) { listener.executionStarted(child); listener.executionFinished(child, TestExecutionResult.successful()); } listener.executionFinished(engine, TestExecutionResult.successful()); }
@Override public void execute(ExecutionRequest request) { Object engine = getEngine(request.getConfigurationParameters()); SimpleClojure.invoke(ENGINE_NS, "execute", engine, request); }
@Override public void execute(ExecutionRequest request) { this.requestForExecution = request; }
@Override public void execute(ExecutionRequest request) { }
protected ExecutionEventRecorder executeTests(LauncherDiscoveryRequest request) { TestDescriptor testDescriptor = discoverTests(request); ExecutionEventRecorder eventRecorder = new ExecutionEventRecorder(); engine.execute(new ExecutionRequest(testDescriptor, eventRecorder, request.getConfigurationParameters())); return eventRecorder; }