Java 类org.junit.platform.engine.ExecutionRequest 实例源码

项目:junit-extensions    文件:ExtensionTester.java   
/**
 * 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;
}
项目:webtester2-core    文件:TestClassExecutor.java   
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;
        }
    }
}
项目:mastering-junit5    文件:MyCustomEngine.java   
@Override
public void execute(ExecutionRequest request) {
    // Use ExecutionRequest to execute TestDescriptor
    TestDescriptor rootTestDescriptor = request.getRootTestDescriptor();
    request.getEngineExecutionListener()
            .executionStarted(rootTestDescriptor);
}
项目:Mastering-Software-Testing-with-JUnit-5    文件:MyCustomEngine.java   
@Override
public void execute(ExecutionRequest request) {
    // Use ExecutionRequest to execute TestDescriptor
    TestDescriptor rootTestDescriptor = request.getRootTestDescriptor();
    request.getEngineExecutionListener()
            .executionStarted(rootTestDescriptor);
}
项目:junit5-docker    文件:JupiterTestEngineForTests.java   
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;
}
项目:junit-pioneer    文件:ExecutionEventRecorder.java   
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();
}
项目:junit5-samples    文件:Machine.java   
@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());
}
项目:jovial    文件:BaseClojureEngine.java   
@Override
public void execute(ExecutionRequest request) {
    Object engine = getEngine(request.getConfigurationParameters());
    SimpleClojure.invoke(ENGINE_NS, "execute", engine, request);
}
项目:junit-pioneer    文件:TestEngineSpy.java   
@Override
public void execute(ExecutionRequest request) {
    this.requestForExecution = request;
}
项目:junit-pioneer    文件:TestEngineStub.java   
@Override
public void execute(ExecutionRequest request) {
}
项目:junit-pioneer    文件:AbstractJupiterTestEngineTests.java   
protected ExecutionEventRecorder executeTests(LauncherDiscoveryRequest request) {
    TestDescriptor testDescriptor = discoverTests(request);
    ExecutionEventRecorder eventRecorder = new ExecutionEventRecorder();
    engine.execute(new ExecutionRequest(testDescriptor, eventRecorder, request.getConfigurationParameters()));
    return eventRecorder;
}