use of org.junit.platform.launcher.TestIdentifier in project intellij-community by JetBrains.
the class JUnit5TestExecutionListener method sendTree.
public void sendTree(TestPlan testPlan, String rootName) {
myTestPlan = testPlan;
myRootName = rootName;
myRoots = testPlan.getRoots();
for (TestIdentifier root : myRoots) {
assert root.isContainer();
for (TestIdentifier testIdentifier : testPlan.getChildren(root)) {
sendTreeUnderRoot(testPlan, testIdentifier, new HashSet<>());
}
}
myPrintStream.println("##teamcity[treeEnded]");
}
use of org.junit.platform.launcher.TestIdentifier in project intellij-community by JetBrains.
the class JUnit5NavigationTest method locationHint.
private String locationHint() {
descriptor.use(myTestSource);
TestIdentifier testIdentifier = TestIdentifier.from(descriptor);
return JUnit5TestExecutionListener.getLocationHint(testIdentifier);
}
use of org.junit.platform.launcher.TestIdentifier in project gradle by gradle.
the class JUnitPlatformTestExecutionListener method createDescriptor.
private TestDescriptorInternal createDescriptor(TestIdentifier test, String name, String displayName) {
TestIdentifier classIdentifier = findClassSource(test);
String className = className(classIdentifier);
String classDisplayName = classDisplayName(classIdentifier);
return new DefaultTestDescriptor(idGenerator.generateId(), className, name, classDisplayName, displayName);
}
use of org.junit.platform.launcher.TestIdentifier in project junit5 by junit-team.
the class XmlReportWriter method writeTestsuite.
private void writeTestsuite(TestIdentifier testIdentifier, List<TestIdentifier> tests, XMLStreamWriter writer) throws XMLStreamException {
// NumberFormat is not thread-safe. Thus, we instantiate it here and pass it to
// writeTestcase instead of using a constant
NumberFormat numberFormat = NumberFormat.getInstance(Locale.US);
writer.writeStartElement("testsuite");
writeSuiteAttributes(testIdentifier, tests, numberFormat, writer);
newLine(writer);
writeSystemProperties(writer);
for (TestIdentifier test : tests) {
writeTestcase(test, numberFormat, writer);
}
writeNonStandardAttributesToSystemOutElement(testIdentifier, writer);
writer.writeEndElement();
newLine(writer);
}
use of org.junit.platform.launcher.TestIdentifier in project junit5 by junit-team.
the class DefaultLauncherTests method prunesTestDescriptorsAfterApplyingPostDiscoveryFilters.
@Test
void prunesTestDescriptorsAfterApplyingPostDiscoveryFilters() {
TestEngineSpy engine = new TestEngineSpy() {
@Override
public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) {
super.discover(discoveryRequest, uniqueId);
TestDescriptorStub engineDescriptor = new TestDescriptorStub(uniqueId, uniqueId.toString());
TestDescriptorStub containerDescriptor = new TestDescriptorStub(uniqueId.append("container", "a"), "container") {
@Override
public Type getType() {
return Type.CONTAINER;
}
};
containerDescriptor.addChild(new TestDescriptorStub(containerDescriptor.getUniqueId().append("test", "b"), "test"));
engineDescriptor.addChild(containerDescriptor);
return engineDescriptor;
}
};
DefaultLauncher launcher = createLauncher(engine);
TestPlan testPlan = launcher.discover(request().filters((PostDiscoveryFilter) testDescriptor -> FilterResult.includedIf(testDescriptor.isContainer())).build());
assertThat(testPlan.getRoots()).hasSize(1);
TestIdentifier engineIdentifier = getOnlyElement(testPlan.getRoots());
assertThat(testPlan.getChildren(engineIdentifier)).isEmpty();
}
Aggregations