use of org.junit.platform.engine.TestEngine in project junit5 by junit-team.
the class DefaultLauncher method execute.
private void execute(Root root, ConfigurationParameters configurationParameters, TestExecutionListener... listeners) {
TestExecutionListenerRegistry listenerRegistry = buildListenerRegistryForExecution(listeners);
TestPlan testPlan = TestPlan.from(root.getEngineDescriptors());
TestExecutionListener testExecutionListener = listenerRegistry.getCompositeTestExecutionListener();
testExecutionListener.testPlanExecutionStarted(testPlan);
ExecutionListenerAdapter engineExecutionListener = new ExecutionListenerAdapter(testPlan, testExecutionListener);
for (TestEngine testEngine : root.getTestEngines()) {
TestDescriptor testDescriptor = root.getTestDescriptorFor(testEngine);
execute(testEngine, new ExecutionRequest(testDescriptor, engineExecutionListener, configurationParameters));
}
testExecutionListener.testPlanExecutionFinished(testPlan);
}
use of org.junit.platform.engine.TestEngine in project junit5 by junit-team.
the class TestEngineTests method defaults.
@Test
void defaults() {
TestEngine engine = new DefaultEngine();
assertEquals(Optional.empty(), engine.getGroupId());
assertEquals(Optional.empty(), engine.getArtifactId());
assertEquals(Optional.of("DEVELOPMENT"), engine.getVersion());
}
use of org.junit.platform.engine.TestEngine in project junit5 by junit-team.
the class DefaultLauncherTests method discoverTestPlanForEngineThatThrowsAnErrorInDiscoverPhase.
@Test
void discoverTestPlanForEngineThatThrowsAnErrorInDiscoverPhase() {
TestEngine engine = new TestEngineStub() {
@Override
public TestDescriptor discover(org.junit.platform.engine.EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) {
throw new Error("ignored");
}
};
TestPlan testPlan = createLauncher(engine).discover(request().build());
assertThat(testPlan.getRoots()).hasSize(0);
}
use of org.junit.platform.engine.TestEngine in project junit5 by junit-team.
the class DefaultLauncherTests method discoverTestPlanForEngineThatThrowsRuntimeExceptionInDiscoverPhase.
@Test
void discoverTestPlanForEngineThatThrowsRuntimeExceptionInDiscoverPhase() {
TestEngine engine = new TestEngineStub() {
@Override
public TestDescriptor discover(org.junit.platform.engine.EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) {
throw new RuntimeException("ignored");
}
};
TestPlan testPlan = createLauncher(engine).discover(request().build());
assertThat(testPlan.getRoots()).hasSize(0);
}
use of org.junit.platform.engine.TestEngine in project junit5 by junit-team.
the class DefaultLauncherTests method discoverTestPlanForEngineThatReturnsNullForItsRootDescriptor.
@Test
void discoverTestPlanForEngineThatReturnsNullForItsRootDescriptor() {
TestEngine engine = new TestEngineStub() {
@Override
public TestDescriptor discover(org.junit.platform.engine.EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) {
return null;
}
};
TestPlan testPlan = createLauncher(engine).discover(request().build());
assertThat(testPlan.getRoots()).hasSize(0);
}
Aggregations