use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class TestTemplateInvocationTests method parentChildRelationshipIsEstablished.
@Test
void parentChildRelationshipIsEstablished() {
LauncherDiscoveryRequest request = request().selectors(selectMethod(MyTestTemplateTestCase.class, "templateWithSingleRegisteredExtension")).build();
ExecutionEventRecorder eventRecorder = executeTests(request);
TestDescriptor templateMethodDescriptor = findTestDescriptor(eventRecorder, container("templateWithSingleRegisteredExtension"));
TestDescriptor invocationDescriptor = findTestDescriptor(eventRecorder, test("test-template-invocation:#1"));
assertThat(invocationDescriptor.getParent()).hasValue(templateMethodDescriptor);
assertThat(templateMethodDescriptor.getChildren()).isEqualTo(singleton(invocationDescriptor));
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class NestedTestClassesTests method doublyNestedTestsAreCorrectlyDiscovered.
@Test
void doublyNestedTestsAreCorrectlyDiscovered() {
LauncherDiscoveryRequest request = request().selectors(selectClass(TestCaseWithDoubleNesting.class)).build();
TestDescriptor engineDescriptor = discoverTests(request);
assertEquals(8, engineDescriptor.getDescendants().size(), "# resolved test descriptors");
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class AbstractJupiterTestEngineTests method executeTests.
protected ExecutionEventRecorder executeTests(LauncherDiscoveryRequest request) {
TestDescriptor testDescriptor = discoverTests(request);
ExecutionEventRecorder eventRecorder = new ExecutionEventRecorder();
engine.execute(new ExecutionRequest(testDescriptor, eventRecorder, request.getConfigurationParameters()));
return eventRecorder;
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class TestClassWithTemplate method twoMethodResolutionsByUniqueId.
@Test
void twoMethodResolutionsByUniqueId() {
UniqueIdSelector selector1 = selectUniqueId(uniqueIdForMethod(MyTestClass.class, "test1()").toString());
UniqueIdSelector selector2 = selectUniqueId(uniqueIdForMethod(MyTestClass.class, "test2()").toString());
// adding same selector twice should have no effect
resolver.resolveSelectors(request().selectors(selector1, selector2, selector2).build(), engineDescriptor);
assertEquals(3, engineDescriptor.getDescendants().size());
List<UniqueId> uniqueIds = uniqueIds();
assertThat(uniqueIds).contains(uniqueIdForClass(MyTestClass.class));
assertThat(uniqueIds).contains(uniqueIdForMethod(MyTestClass.class, "test1()"));
assertThat(uniqueIds).contains(uniqueIdForMethod(MyTestClass.class, "test2()"));
TestDescriptor classFromMethod1 = descriptorByUniqueId(uniqueIdForMethod(MyTestClass.class, "test1()")).getParent().get();
TestDescriptor classFromMethod2 = descriptorByUniqueId(uniqueIdForMethod(MyTestClass.class, "test2()")).getParent().get();
assertEquals(classFromMethod1, classFromMethod2);
assertSame(classFromMethod1, classFromMethod2);
}
use of org.junit.platform.engine.TestDescriptor in project junit5 by junit-team.
the class DiscoveryTests method discoverMethodByUniqueIdForOverloadedMethodVariantThatAcceptsArguments.
@Test
void discoverMethodByUniqueIdForOverloadedMethodVariantThatAcceptsArguments() {
LauncherDiscoveryRequest request = request().selectors(selectUniqueId(JupiterUniqueIdBuilder.uniqueIdForMethod(LocalTestCase.class, "test4(" + TestInfo.class.getName() + ")"))).build();
TestDescriptor engineDescriptor = discoverTests(request);
assertEquals(2, engineDescriptor.getDescendants().size(), "# resolved test descriptors");
}
Aggregations