use of com.epam.ta.reportportal.ws.model.StartTestItemRQ 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));
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-junit5 by reportportal.
the class TestCaseIdTest method test_verify_test_case_id_supports_templating_with_self_reference.
@Test
void test_verify_test_case_id_supports_templating_with_self_reference() {
TestUtils.runClasses(TestCaseIdTemplateTest.class);
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(1)).startTestItem(notNull(), captor.capture());
StartTestItemRQ request = captor.getValue();
assertThat(request.getTestCaseId(), equalTo(TestCaseIdTemplateTest.TEST_CASE_ID_VALUE.replace("{this.FIELD}", TestCaseIdTemplateTest.FIELD)));
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project allure-java by reportportal.
the class LinkAnnotationTest method test_description_should_not_override_attached_links.
@Test
public void test_description_should_not_override_attached_links() {
mockLaunch(client, namedUuid("launchUuid"), suitedUuid, testClassUuid, stepUuids.get(0));
TestNG result = runTests(TestLinkAndDescription.class);
assertThat(result.getStatus(), equalTo(0));
ArgumentCaptor<StartTestItemRQ> startMethodCapture = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start test step
verify(client).startTestItem(same(testClassUuid), startMethodCapture.capture());
StartTestItemRQ startRequest = startMethodCapture.getValue();
assertThat(startRequest.getDescription(), equalTo(TestLinkAndDescription.DESCRIPTION + FormatUtils.MARKDOWN_DELIMITER + FormatUtils.LINK_PREFIX + String.format(FormatUtils.LINK_MARKDOWN, TestLinkAndDescription.LINK_NAME, TestLinkAndDescription.LINK_URL)));
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project allure-java by reportportal.
the class LinkAnnotationTest method test_description_should_not_override_attached_links_in_configuration_method.
@Test
public void test_description_should_not_override_attached_links_in_configuration_method() {
mockLaunch(client, namedUuid("launchUuid"), suitedUuid, testClassUuid, stepUuids);
TestNG result = runTests(TestLinkAndDescriptionBefore.class);
assertThat(result.getStatus(), equalTo(0));
ArgumentCaptor<StartTestItemRQ> startMethodCapture = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start test step
verify(client, times(2)).startTestItem(same(testClassUuid), startMethodCapture.capture());
List<StartTestItemRQ> startBeforeRequests = startMethodCapture.getAllValues().stream().filter(s -> ItemType.BEFORE_METHOD.name().equals(s.getType())).collect(Collectors.toList());
assertThat(startBeforeRequests, hasSize(1));
StartTestItemRQ startRequest = startBeforeRequests.get(0);
assertThat(startRequest.getDescription(), equalTo(TestLinkAndDescriptionBefore.DESCRIPTION + FormatUtils.MARKDOWN_DELIMITER + FormatUtils.LINK_PREFIX + String.format(FormatUtils.LINK_MARKDOWN, TestLinkAndDescriptionBefore.LINK_NAME, TestLinkAndDescriptionBefore.LINK_URL)));
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project allure-java by reportportal.
the class MethodNestedStepsTest method test_two_levels_method_step.
@Test
public void test_two_levels_method_step() {
mockNestedSteps(client, nestedStepLinks.get(0));
mockNestedSteps(client, Pair.of(nestedSteps.get(0), nestedSteps.get(1)));
TestNG result = runTests(MethodTwoLevelsStep.class);
assertThat(result.getStatus(), equalTo(0));
ArgumentCaptor<StartTestItemRQ> startNestedStepCapture1 = ArgumentCaptor.forClass(StartTestItemRQ.class);
verify(client).startTestItem(same(stepUuid), startNestedStepCapture1.capture());
ArgumentCaptor<StartTestItemRQ> startNestedStepCapture2 = ArgumentCaptor.forClass(StartTestItemRQ.class);
verify(client).startTestItem(same(nestedSteps.get(0)), startNestedStepCapture2.capture());
StartTestItemRQ startStep1 = startNestedStepCapture1.getValue();
assertThat(startStep1.getName(), not(emptyOrNullString()));
assertThat(startStep1.isHasStats(), equalTo(Boolean.FALSE));
StartTestItemRQ startStep2 = startNestedStepCapture2.getValue();
assertThat(startStep2.getName(), not(emptyOrNullString()));
assertThat(startStep2.isHasStats(), equalTo(Boolean.FALSE));
ArgumentCaptor<FinishTestItemRQ> finishNestedStepCapture1 = ArgumentCaptor.forClass(FinishTestItemRQ.class);
verify(client).finishTestItem(same(nestedSteps.get(0)), finishNestedStepCapture1.capture());
FinishTestItemRQ finishStep1 = finishNestedStepCapture1.getValue();
assertThat(finishStep1.getStatus(), equalTo(ItemStatus.PASSED.name()));
ArgumentCaptor<FinishTestItemRQ> finishNestedStepCapture2 = ArgumentCaptor.forClass(FinishTestItemRQ.class);
verify(client).finishTestItem(same(nestedSteps.get(1)), finishNestedStepCapture2.capture());
FinishTestItemRQ finishStep2 = finishNestedStepCapture2.getValue();
assertThat(finishStep2.getStatus(), equalTo(ItemStatus.PASSED.name()));
}
Aggregations