use of org.apache.maven.surefire.report.ReportEntry in project junit5 by junit-team.
the class JUnitPlatformProviderTests method usesClassNamesForXmlReport.
@Test
void usesClassNamesForXmlReport() throws TestSetFailedException, InvocationTargetException {
String[] classNames = { "org.junit.platform.surefire.provider.JUnitPlatformProviderTests$Sub1Tests", "org.junit.platform.surefire.provider.JUnitPlatformProviderTests$Sub2Tests" };
ProviderParameters providerParameters = providerParametersMock(Sub1Tests.class, Sub2Tests.class);
JUnitPlatformProvider jUnitPlatformProvider = new JUnitPlatformProvider(providerParameters);
TestsToRun testsToRun = newTestsToRun(Sub1Tests.class, Sub2Tests.class);
invokeProvider(jUnitPlatformProvider, testsToRun);
RunListener reporter = providerParameters.getReporterFactory().createReporter();
ArgumentCaptor<ReportEntry> reportEntryArgumentCaptor = ArgumentCaptor.forClass(ReportEntry.class);
verify(reporter, times(2)).testSucceeded(reportEntryArgumentCaptor.capture());
List<ReportEntry> allValues = reportEntryArgumentCaptor.getAllValues();
assertThat(allValues).extracting(ReportEntry::getSourceName).containsExactly(classNames);
}
use of org.apache.maven.surefire.report.ReportEntry in project junit5 by junit-team.
the class RunListenerAdapterTests method notifiedWithCorrectNamesWhenMethodExecutionStarted.
@Test
void notifiedWithCorrectNamesWhenMethodExecutionStarted() throws Exception {
ArgumentCaptor<ReportEntry> entryCaptor = ArgumentCaptor.forClass(ReportEntry.class);
TestPlan testPlan = TestPlan.from(Collections.singletonList(new EngineDescriptor(newId(), "Luke's Plan")));
adapter.testPlanExecutionStarted(testPlan);
TestIdentifier methodIdentifier = identifiersAsParentOnTestPlan(testPlan, newClassDescriptor(), newMethodDescriptor());
adapter.executionStarted(methodIdentifier);
verify(listener).testStarting(entryCaptor.capture());
ReportEntry entry = entryCaptor.getValue();
assertEquals(MY_TEST_METHOD_NAME, entry.getName());
assertEquals(MyTestClass.class.getName(), entry.getSourceName());
assertNull(entry.getStackTraceWriter());
}
use of org.apache.maven.surefire.report.ReportEntry in project junit5 by junit-team.
the class RunListenerAdapterTests method displayNamesIgnoredInReport.
@Test
void displayNamesIgnoredInReport() throws NoSuchMethodException {
TestMethodTestDescriptor descriptor = new TestMethodTestDescriptor(newId(), MyTestClass.class, MyTestClass.class.getDeclaredMethod("myNamedTestMethod"));
TestIdentifier factoryIdentifier = TestIdentifier.from(descriptor);
ArgumentCaptor<ReportEntry> entryCaptor = ArgumentCaptor.forClass(ReportEntry.class);
adapter.executionSkipped(factoryIdentifier, "");
verify(listener).testSkipped(entryCaptor.capture());
ReportEntry value = entryCaptor.getValue();
assertEquals("myNamedTestMethod", value.getName());
}
use of org.apache.maven.surefire.report.ReportEntry in project junit5 by junit-team.
the class RunListenerAdapterTests method notifiedWithCompatibleNameForMethodWithArguments.
@Test
void notifiedWithCompatibleNameForMethodWithArguments() throws Exception {
ArgumentCaptor<ReportEntry> entryCaptor = ArgumentCaptor.forClass(ReportEntry.class);
TestPlan testPlan = TestPlan.from(Collections.singletonList(new EngineDescriptor(newId(), "Luke's Plan")));
adapter.testPlanExecutionStarted(testPlan);
TestIdentifier methodIdentifier = identifiersAsParentOnTestPlan(testPlan, newClassDescriptor(), newMethodDescriptor(String.class));
adapter.executionStarted(methodIdentifier);
verify(listener).testStarting(entryCaptor.capture());
ReportEntry entry = entryCaptor.getValue();
assertEquals(MY_TEST_METHOD_NAME + "{String}", entry.getName());
assertEquals(MyTestClass.class.getName(), entry.getSourceName());
assertNull(entry.getStackTraceWriter());
}
Aggregations