use of org.junit.platform.launcher.TestIdentifier in project gradle by gradle.
the class JUnitPlatformTestExecutionListener method getAncestors.
private Set<TestIdentifier> getAncestors(TestIdentifier testIdentifier) {
Set<TestIdentifier> result = new LinkedHashSet<>();
Optional<String> parentId = testIdentifier.getParentId();
while (parentId.isPresent()) {
TestIdentifier parent = currentTestPlan.getTestIdentifier(parentId.get());
result.add(parent);
parentId = parent.getParentId();
}
return result;
}
use of org.junit.platform.launcher.TestIdentifier in project gradle by gradle.
the class JUnitPlatformTestExecutionListener method createTestClassDescriptor.
private DefaultTestClassDescriptor createTestClassDescriptor(TestIdentifier node) {
TestIdentifier classIdentifier = findTestClassIdentifier(node);
String className = className(classIdentifier);
String classDisplayName = node.getDisplayName();
return new DefaultTestClassDescriptor(idGenerator.generateId(), className, classDisplayName);
}
use of org.junit.platform.launcher.TestIdentifier in project neo4j by neo4j.
the class ProfilerExtensionTest method profilingExtensionMustNotBreakOnUninitialisedTestDirectory.
@Test
void profilingExtensionMustNotBreakOnUninitialisedTestDirectory() {
// Because this test *aborts* rather than fails or completes normally, we will be in a state where we both have an
// execution exception *and* the TestDirectoryExtension cleans up after itself as if the test was a success.
// In this case, the profiler extension will see an uninitialised TestDirectoryExtension, and must be able to cope
// with that. Furthermore, these particular tests are arranged such that the TestDirectoryExtension has its
// lifecycle nested within the ProfilerExtension, which means that the test directory will do its cleanup
// before the profiler extension gets to write its results.
CONTEXT.clear();
execute(ProfiledTemplateVerification.class, "testThatFailsBeforeInitialisingTestDirectory", new TestExecutionListener() {
@Override
public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) {
// Notably, we should not see any FAILED results.
assertThat(testExecutionResult.getStatus()).isIn(SUCCESSFUL, ABORTED);
}
});
}
use of org.junit.platform.launcher.TestIdentifier in project junit5 by junit-team.
the class XmlReportWriter method writeXmlReport.
void writeXmlReport(TestIdentifier rootDescriptor, Writer out) throws XMLStreamException {
TestPlan testPlan = this.reportData.getTestPlan();
Map<TestIdentifier, AggregatedTestResult> tests = //
testPlan.getDescendants(rootDescriptor).stream().filter(//
testIdentifier -> shouldInclude(testPlan, testIdentifier)).collect(//
toMap(identity(), this::toAggregatedResult));
writeXmlReport(rootDescriptor, tests, out);
}
use of org.junit.platform.launcher.TestIdentifier in project junit5 by junit-team.
the class ExecutionListenerAdapter method dynamicTestRegistered.
@Override
public void dynamicTestRegistered(TestDescriptor testDescriptor) {
TestIdentifier testIdentifier = TestIdentifier.from(testDescriptor);
this.testPlan.addInternal(testIdentifier);
this.testExecutionListener.dynamicTestRegistered(testIdentifier);
}
Aggregations