use of org.junit.platform.engine.TestExecutionResult in project junit5 by junit-team.
the class XmlReportData method getResult.
Optional<TestExecutionResult> getResult(TestIdentifier testIdentifier) {
if (this.finishedTests.containsKey(testIdentifier)) {
return Optional.of(this.finishedTests.get(testIdentifier));
}
Optional<TestIdentifier> parent = this.testPlan.getParent(testIdentifier);
Optional<TestIdentifier> ancestor = findAncestor(parent, this.finishedTests::containsKey);
if (ancestor.isPresent()) {
TestExecutionResult result = this.finishedTests.get(ancestor.get());
if (result.getStatus() != SUCCESSFUL) {
return Optional.of(result);
}
}
return Optional.empty();
}
use of org.junit.platform.engine.TestExecutionResult in project junit5 by junit-team.
the class VintageLauncherIntegrationTests method removesCompleteClassIfItHasExcludedTag.
@Test
void removesCompleteClassIfItHasExcludedTag() {
Class<?> testClass = PlainJUnit4TestCaseWithFiveTestMethods.class;
LauncherDiscoveryRequestBuilder request = //
request().selectors(//
selectClass(testClass)).filters(excludeTags(Categories.Plain.class.getName()));
TestPlan testPlan = discover(request);
assertThat(testPlan.getDescendants(getOnlyElement(testPlan.getRoots()))).isEmpty();
Map<TestIdentifier, TestExecutionResult> results = execute(request);
//
assertThat(results.keySet().stream().map(TestIdentifier::getDisplayName)).containsExactly("JUnit Vintage");
}
use of org.junit.platform.engine.TestExecutionResult in project junit5 by junit-team.
the class XmlReportDataTests method resultOfTestIdentifierWithoutReportedEventsIsEmptyWhenAncestorWasSuccessful.
@Test
void resultOfTestIdentifierWithoutReportedEventsIsEmptyWhenAncestorWasSuccessful() {
EngineDescriptor engineDescriptor = new EngineDescriptor(UniqueId.forEngine("engine"), "Engine");
engineDescriptor.addChild(new TestDescriptorStub(UniqueId.root("child", "test"), "test"));
TestPlan testPlan = TestPlan.from(singleton(engineDescriptor));
XmlReportData reportData = new XmlReportData(testPlan, Clock.systemDefaultZone());
reportData.markFinished(testPlan.getTestIdentifier("[engine:engine]"), successful());
Optional<TestExecutionResult> result = reportData.getResult(testPlan.getTestIdentifier("[child:test]"));
assertThat(result).isEmpty();
}
use of org.junit.platform.engine.TestExecutionResult in project junit5 by junit-team.
the class XmlReportDataTests method resultOfTestIdentifierWithoutAnyReportedEventsIsEmpty.
@Test
void resultOfTestIdentifierWithoutAnyReportedEventsIsEmpty() {
EngineDescriptor engineDescriptor = new EngineDescriptor(UniqueId.forEngine("engine"), "Engine");
engineDescriptor.addChild(new TestDescriptorStub(UniqueId.root("child", "test"), "test"));
TestPlan testPlan = TestPlan.from(singleton(engineDescriptor));
XmlReportData reportData = new XmlReportData(testPlan, Clock.systemDefaultZone());
Optional<TestExecutionResult> result = reportData.getResult(testPlan.getTestIdentifier("[child:test]"));
assertThat(result).isEmpty();
}
use of org.junit.platform.engine.TestExecutionResult in project junit5 by junit-team.
the class XmlReportDataTests method resultOfTestIdentifierWithoutReportedEventsIsFailureOfAncestor.
@Test
void resultOfTestIdentifierWithoutReportedEventsIsFailureOfAncestor() {
EngineDescriptor engineDescriptor = new EngineDescriptor(UniqueId.forEngine("engine"), "Engine");
engineDescriptor.addChild(new TestDescriptorStub(UniqueId.root("child", "test"), "test"));
TestPlan testPlan = TestPlan.from(singleton(engineDescriptor));
XmlReportData reportData = new XmlReportData(testPlan, Clock.systemDefaultZone());
TestExecutionResult failureOfAncestor = failed(new RuntimeException("failed!"));
reportData.markFinished(testPlan.getTestIdentifier("[engine:engine]"), failureOfAncestor);
Optional<TestExecutionResult> result = reportData.getResult(testPlan.getTestIdentifier("[child:test]"));
assertThat(result).contains(failureOfAncestor);
}
Aggregations