use of org.junit.platform.launcher.TestPlan 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.launcher.TestPlan 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.launcher.TestPlan 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);
}
use of org.junit.platform.launcher.TestPlan in project junit5 by junit-team.
the class XmlReportWriterTests method writesTestsuiteElementsWithoutTestcaseElementsWithoutAnyTests.
@Test
void writesTestsuiteElementsWithoutTestcaseElementsWithoutAnyTests() throws Exception {
TestPlan testPlan = TestPlan.from(singleton(engineDescriptor));
XmlReportData reportData = new XmlReportData(testPlan, Clock.systemDefaultZone());
String content = writeXmlReport(testPlan, reportData);
assertValidAccordingToJenkinsSchema(content);
// @formatter:off
assertThat(content).containsSubsequence("<testsuite name=\"Engine\" tests=\"0\"", "</testsuite>").doesNotContain("<testcase");
// @formatter:on
}
use of org.junit.platform.launcher.TestPlan in project junit5 by junit-team.
the class XmlReportWriterTests method writesEmptySkippedElementForSkippedTestWithoutReason.
@Test
void writesEmptySkippedElementForSkippedTestWithoutReason() throws Exception {
UniqueId uniqueId = engineDescriptor.getUniqueId().append("test", "test");
engineDescriptor.addChild(new TestDescriptorStub(uniqueId, "skippedTest"));
TestPlan testPlan = TestPlan.from(singleton(engineDescriptor));
XmlReportData reportData = new XmlReportData(testPlan, Clock.systemDefaultZone());
reportData.markSkipped(testPlan.getTestIdentifier(uniqueId.toString()), null);
String content = writeXmlReport(testPlan, reportData);
assertValidAccordingToJenkinsSchema(content);
// @formatter:off
assertThat(content).containsSubsequence("<testcase name=\"skippedTest\"", "<skipped/>", "</testcase>");
// @formatter:on
}
Aggregations