use of com.epam.reportportal.junit5.features.testcaseid in project agent-java-junit5 by reportportal.
the class TestCaseIdTest method testCaseIdFromCodeRefAndParamsTest.
@Test
void testCaseIdFromCodeRefAndParamsTest() {
TestUtils.runClasses(TestCaseIdFromCodeRefAndParamsTest.class);
String expectedCodeRef = "com.epam.reportportal.junit5.features.testcaseid.TestCaseIdFromCodeRefAndParamsTest.parametrized";
List<String> expected = IntStream.of(101, 0).mapToObj(it -> expectedCodeRef + "[" + it + "]").collect(Collectors.toList());
Launch launch = TestCaseIdExtension.LAUNCH;
// Start parent Suite
verify(launch, times(1)).startTestItem(any());
ArgumentCaptor<StartTestItemRQ> captor = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start a test
verify(launch, times(3)).startTestItem(notNull(), captor.capture());
List<StartTestItemRQ> requests = captor.getAllValues();
assertThat(requests.stream().map(e -> e.getType().toLowerCase()).collect(Collectors.toList()), hasItem("suite"));
List<String> actual = requests.stream().filter(it -> "step".equalsIgnoreCase(it.getType())).map(StartTestItemRQ::getTestCaseId).collect(Collectors.toList());
assertThat(actual, equalTo(expected));
}
Aggregations