Search in sources :

Example 11 with StartTestItemRQ

use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-testNG by reportportal.

the class TestCaseIdTest method testCaseIdFromCodeRef.

@Test
public void testCaseIdFromCodeRef() {
    TestUtils.runTests(Collections.singletonList(TestReportPortalListener.class), TestCaseIdFromCodeReference.class);
    String expectedCodeRef = TestCaseIdFromCodeReference.class.getCanonicalName() + "." + TestCaseIdFromCodeReference.STEP_NAME;
    // Start parent suite
    verify(launch, times(1)).startTestItem(any());
    ArgumentCaptor<StartTestItemRQ> captor = ArgumentCaptor.forClass(StartTestItemRQ.class);
    // Start test and step
    verify(launch, times(2)).startTestItem(any(), captor.capture());
    StartTestItemRQ testRequest = extractRequest(captor, "test");
    StartTestItemRQ stepRequest = extractRequest(captor, "step");
    assertThat(testRequest.getName(), equalTo(TestUtils.TEST_NAME));
    assertThat(stepRequest.getCodeRef(), equalTo(expectedCodeRef));
    assertThat(stepRequest.getTestCaseId(), equalTo(expectedCodeRef));
}
Also used : StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 12 with StartTestItemRQ

use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-testNG by reportportal.

the class TestCaseIdTest method testCaseIdFromAnnotationValue.

@Test
public void testCaseIdFromAnnotationValue() {
    TestUtils.runTests(Collections.singletonList(TestReportPortalListener.class), TestCaseIdFromAnnotationValue.class);
    // Start parent suites
    verify(launch, times(1)).startTestItem(any());
    ArgumentCaptor<StartTestItemRQ> captor = ArgumentCaptor.forClass(StartTestItemRQ.class);
    // Start test and step
    verify(launch, times(2)).startTestItem(any(), captor.capture());
    StartTestItemRQ testRequest = extractRequest(captor, "test");
    StartTestItemRQ stepRequest = extractRequest(captor, "step");
    assertThat(testRequest.getName(), equalTo(TestUtils.TEST_NAME));
    assertThat(stepRequest.getTestCaseId(), equalTo(TestCaseIdFromAnnotationValue.TEST_CASE_ID));
}
Also used : StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 13 with StartTestItemRQ

use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-testNG by reportportal.

the class TestCaseIdTest method verify_test_case_id_parameterized_no_marked_parameters.

@Test
public void verify_test_case_id_parameterized_no_marked_parameters() {
    TestUtils.runTests(Collections.singletonList(TestReportPortalListener.class), TestCaseIdFromAnnotationValueParametrizedNoParam.class);
    // Start parent suites
    verify(launch, times(1)).startTestItem(any());
    ArgumentCaptor<StartTestItemRQ> captor = ArgumentCaptor.forClass(StartTestItemRQ.class);
    // Start test and step
    verify(launch, times(4)).startTestItem(any(), captor.capture());
    StartTestItemRQ testRequest = extractRequest(captor, "test");
    List<StartTestItemRQ> stepRequests = extractRequests(captor, "step");
    List<String> actualTestCaseIds = stepRequests.stream().map(StartTestItemRQ::getTestCaseId).collect(Collectors.toList());
    assertThat(testRequest.getName(), equalTo(TestUtils.TEST_NAME));
    assertThat(actualTestCaseIds, containsInAnyOrder("[one,1]", "[two,2]", "[three,3]"));
}
Also used : StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 14 with StartTestItemRQ

use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-testNG by reportportal.

the class TestNameAndDescriptionTest method test_name_should_be_passed_to_rp_if_specified.

@Test
public void test_name_should_be_passed_to_rp_if_specified() {
    runTests(Collections.singletonList(TestNgListener.class), AnnotationNamedClassTest.class);
    // Start launch
    verify(client, times(1)).startLaunch(any());
    // Start parent suites
    verify(client, times(1)).startTestItem(any());
    ArgumentCaptor<StartTestItemRQ> startTestCapture = ArgumentCaptor.forClass(StartTestItemRQ.class);
    // Start test class
    verify(client, times(1)).startTestItem(same(suitedUuid), startTestCapture.capture());
    // Start test step
    verify(client, times(1)).startTestItem(same(testClassUuid), any());
    StartTestItemRQ startItem = startTestCapture.getAllValues().get(0);
    assertThat(startItem.isRetry(), nullValue());
    assertThat(startItem.getName(), equalTo(AnnotationNamedClassTest.TEST_NAME));
}
Also used : TestNgListener(com.epam.reportportal.testng.integration.TestNgListener) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) DescriptionTest(com.epam.reportportal.testng.integration.feature.description.DescriptionTest) AnnotationNamedParameterizedClassTest(com.epam.reportportal.testng.integration.feature.name.AnnotationNamedParameterizedClassTest) Test(org.junit.jupiter.api.Test) AnnotationNamedClassTest(com.epam.reportportal.testng.integration.feature.name.AnnotationNamedClassTest)

Example 15 with StartTestItemRQ

use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-testNG by reportportal.

the class TestNameAndDescriptionTest method test_description_should_be_passed_to_rp_if_specified.

@Test
public void test_description_should_be_passed_to_rp_if_specified() {
    runTests(Collections.singletonList(TestNgListener.class), DescriptionTest.class);
    // Start launch
    verify(client, times(1)).startLaunch(any());
    // Start parent suites
    verify(client, times(1)).startTestItem(any());
    // Start test class
    verify(client, times(1)).startTestItem(same(suitedUuid), any());
    ArgumentCaptor<StartTestItemRQ> startTestCapture = ArgumentCaptor.forClass(StartTestItemRQ.class);
    verify(client, times(1)).startTestItem(same(testClassUuid), startTestCapture.capture());
    StartTestItemRQ startItem = startTestCapture.getAllValues().get(0);
    assertThat(startItem.getDescription(), equalTo(DescriptionTest.TEST_DESCRIPTION));
}
Also used : TestNgListener(com.epam.reportportal.testng.integration.TestNgListener) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) DescriptionTest(com.epam.reportportal.testng.integration.feature.description.DescriptionTest) AnnotationNamedParameterizedClassTest(com.epam.reportportal.testng.integration.feature.name.AnnotationNamedParameterizedClassTest) Test(org.junit.jupiter.api.Test) AnnotationNamedClassTest(com.epam.reportportal.testng.integration.feature.name.AnnotationNamedClassTest)

Aggregations

StartTestItemRQ (com.epam.ta.reportportal.ws.model.StartTestItemRQ)159 Test (org.junit.jupiter.api.Test)124 FinishTestItemRQ (com.epam.ta.reportportal.ws.model.FinishTestItemRQ)30 List (java.util.List)21 TestNG (org.testng.TestNG)21 Launch (com.epam.reportportal.service.Launch)20 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)19 BeforeEach (org.junit.jupiter.api.BeforeEach)19 TestNgListener (com.epam.reportportal.testng.util.TestNgListener)18 Collectors (java.util.stream.Collectors)17 ArgumentCaptor (org.mockito.ArgumentCaptor)17 ReportPortal (com.epam.reportportal.service.ReportPortal)16 ReportPortalClient (com.epam.reportportal.service.ReportPortalClient)15 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)15 ArgumentMatchers.same (org.mockito.ArgumentMatchers.same)14 ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)13 ItemAttributesRQ (com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ)13 BaseMvcTest (com.epam.ta.reportportal.ws.BaseMvcTest)12 Set (java.util.Set)12 Nonnull (javax.annotation.Nonnull)12