Search in sources :

Example 56 with StartTestItemRQ

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

the class AllureAwareListener method buildFixtureItemRq.

@Override
@Nonnull
protected StartTestItemRQ buildFixtureItemRq(@Nonnull FeatureInfo feature, @Nonnull MethodInfo fixture, boolean inherited) {
    StartTestItemRQ rq = super.buildFixtureItemRq(feature, fixture, inherited);
    Method method = fixture.getReflection();
    processLabels(rq, method);
    processDescription(rq, Thread.currentThread().getContextClassLoader(), method);
    processLinks(rq, method);
    return rq;
}
Also used : Method(java.lang.reflect.Method) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Nonnull(javax.annotation.Nonnull)

Example 57 with StartTestItemRQ

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

the class AllureAwareService method buildStartStepRq.

@Override
@Nonnull
protected StartTestItemRQ buildStartStepRq(@Nonnull final ITestResult testResult, @Nonnull final TestMethodType type) {
    StartTestItemRQ rq = super.buildStartStepRq(testResult, type);
    getMethod(testResult.getMethod()).ifPresent(m -> {
        processLabels(rq, m);
        processAllureId(rq, m);
        processDescription(rq, Thread.currentThread().getContextClassLoader(), m);
        processLinks(rq, m);
        processPriority(rq, m);
        processFlaky(rq, m);
        processMuted(rq, m);
    });
    ofNullable(rq.getDescription()).ifPresent(d -> DESCRIPTION_TRACKER.put(testResult, d));
    return rq;
}
Also used : StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Nonnull(javax.annotation.Nonnull)

Example 58 with StartTestItemRQ

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

the class AllureIdAnnotationTest method test_allure_id_test_case_id_override.

@Test
public void test_allure_id_test_case_id_override() {
    runTests(Collections.singletonList(TestNgListener.class), TestAllureIdTestCaseIdOverride.class);
    // Start launch
    verify(client).startLaunch(any());
    // Start parent suites
    verify(client).startTestItem(any());
    // Start test class
    verify(client).startTestItem(same(suitedUuid), any());
    ArgumentCaptor<StartTestItemRQ> startMethodCapture = ArgumentCaptor.forClass(StartTestItemRQ.class);
    // Start test step
    verify(client).startTestItem(same(testClassUuid), startMethodCapture.capture());
    StartTestItemRQ startMethod = startMethodCapture.getValue();
    Set<ItemAttributesRQ> attributes = startMethod.getAttributes();
    List<ItemAttributesRQ> idAttributes = attributes.stream().filter(a -> "AS_ID".equals(a.getKey())).collect(Collectors.toList());
    assertThat(idAttributes, hasSize(1));
    ItemAttributesRQ id = idAttributes.get(0);
    assertThat(id.getValue(), equalTo("My ID"));
    assertThat(startMethod.getTestCaseId(), equalTo("My Test Case ID"));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) TestAllureIdParams(com.epam.reportportal.testng.features.allureid.TestAllureIdParams) BeforeEach(org.junit.jupiter.api.BeforeEach) ReportPortalClient(com.epam.reportportal.service.ReportPortalClient) Set(java.util.Set) ReportPortal(com.epam.reportportal.service.ReportPortal) TestAllureIdTestCaseIdOverride(com.epam.reportportal.testng.features.allureid.TestAllureIdTestCaseIdOverride) TestAllureIdNoParams(com.epam.reportportal.testng.features.allureid.TestAllureIdNoParams) Collectors(java.util.stream.Collectors) Mockito.verify(org.mockito.Mockito.verify) Test(org.junit.jupiter.api.Test) TestNgListener(com.epam.reportportal.testng.util.TestNgListener) ItemAttributesRQ(com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) List(java.util.List) ArgumentCaptor(org.mockito.ArgumentCaptor) Matchers.equalTo(org.hamcrest.Matchers.equalTo) Matchers.hasSize(org.hamcrest.Matchers.hasSize) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) TestUtils(com.epam.reportportal.testng.util.TestUtils) Collections(java.util.Collections) ArgumentMatchers.same(org.mockito.ArgumentMatchers.same) Mockito.mock(org.mockito.Mockito.mock) TestNgListener(com.epam.reportportal.testng.util.TestNgListener) ItemAttributesRQ(com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 59 with StartTestItemRQ

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

the class AllureIdAnnotationTest method test_allure_id_no_params.

@Test
public void test_allure_id_no_params() {
    runTests(Collections.singletonList(TestNgListener.class), TestAllureIdNoParams.class);
    // Start launch
    verify(client).startLaunch(any());
    // Start parent suites
    verify(client).startTestItem(any());
    // Start test class
    verify(client).startTestItem(same(suitedUuid), any());
    ArgumentCaptor<StartTestItemRQ> startMethodCapture = ArgumentCaptor.forClass(StartTestItemRQ.class);
    // Start test step
    verify(client).startTestItem(same(testClassUuid), startMethodCapture.capture());
    StartTestItemRQ startMethod = startMethodCapture.getValue();
    Set<ItemAttributesRQ> attributes = startMethod.getAttributes();
    List<ItemAttributesRQ> idAttributes = attributes.stream().filter(a -> "AS_ID".equals(a.getKey())).collect(Collectors.toList());
    assertThat(idAttributes, hasSize(1));
    ItemAttributesRQ id = idAttributes.get(0);
    assertThat(id.getValue(), equalTo("My no params ID"));
    assertThat(startMethod.getTestCaseId(), equalTo("My no params ID"));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) TestAllureIdParams(com.epam.reportportal.testng.features.allureid.TestAllureIdParams) BeforeEach(org.junit.jupiter.api.BeforeEach) ReportPortalClient(com.epam.reportportal.service.ReportPortalClient) Set(java.util.Set) ReportPortal(com.epam.reportportal.service.ReportPortal) TestAllureIdTestCaseIdOverride(com.epam.reportportal.testng.features.allureid.TestAllureIdTestCaseIdOverride) TestAllureIdNoParams(com.epam.reportportal.testng.features.allureid.TestAllureIdNoParams) Collectors(java.util.stream.Collectors) Mockito.verify(org.mockito.Mockito.verify) Test(org.junit.jupiter.api.Test) TestNgListener(com.epam.reportportal.testng.util.TestNgListener) ItemAttributesRQ(com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) List(java.util.List) ArgumentCaptor(org.mockito.ArgumentCaptor) Matchers.equalTo(org.hamcrest.Matchers.equalTo) Matchers.hasSize(org.hamcrest.Matchers.hasSize) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) TestUtils(com.epam.reportportal.testng.util.TestUtils) Collections(java.util.Collections) ArgumentMatchers.same(org.mockito.ArgumentMatchers.same) Mockito.mock(org.mockito.Mockito.mock) TestNgListener(com.epam.reportportal.testng.util.TestNgListener) ItemAttributesRQ(com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 60 with StartTestItemRQ

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

the class AllureIdAnnotationTest method test_allure_id_with_params.

@Test
public void test_allure_id_with_params() {
    runTests(Collections.singletonList(TestNgListener.class), TestAllureIdParams.class);
    // Start launch
    verify(client).startLaunch(any());
    // Start parent suites
    verify(client).startTestItem(any());
    // Start test class
    verify(client).startTestItem(same(suitedUuid), any());
    ArgumentCaptor<StartTestItemRQ> startMethodCapture = ArgumentCaptor.forClass(StartTestItemRQ.class);
    // Start test step
    verify(client).startTestItem(same(testClassUuid), startMethodCapture.capture());
    StartTestItemRQ startMethod = startMethodCapture.getValue();
    Set<ItemAttributesRQ> attributes = startMethod.getAttributes();
    List<ItemAttributesRQ> idAttributes = attributes.stream().filter(a -> "AS_ID".equals(a.getKey())).collect(Collectors.toList());
    assertThat(idAttributes, hasSize(1));
    ItemAttributesRQ id = idAttributes.get(0);
    assertThat(id.getValue(), equalTo("My ID"));
    assertThat(startMethod.getTestCaseId(), equalTo("My ID[Data step name]"));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) TestAllureIdParams(com.epam.reportportal.testng.features.allureid.TestAllureIdParams) BeforeEach(org.junit.jupiter.api.BeforeEach) ReportPortalClient(com.epam.reportportal.service.ReportPortalClient) Set(java.util.Set) ReportPortal(com.epam.reportportal.service.ReportPortal) TestAllureIdTestCaseIdOverride(com.epam.reportportal.testng.features.allureid.TestAllureIdTestCaseIdOverride) TestAllureIdNoParams(com.epam.reportportal.testng.features.allureid.TestAllureIdNoParams) Collectors(java.util.stream.Collectors) Mockito.verify(org.mockito.Mockito.verify) Test(org.junit.jupiter.api.Test) TestNgListener(com.epam.reportportal.testng.util.TestNgListener) ItemAttributesRQ(com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) List(java.util.List) ArgumentCaptor(org.mockito.ArgumentCaptor) Matchers.equalTo(org.hamcrest.Matchers.equalTo) Matchers.hasSize(org.hamcrest.Matchers.hasSize) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) TestUtils(com.epam.reportportal.testng.util.TestUtils) Collections(java.util.Collections) ArgumentMatchers.same(org.mockito.ArgumentMatchers.same) Mockito.mock(org.mockito.Mockito.mock) TestNgListener(com.epam.reportportal.testng.util.TestNgListener) ItemAttributesRQ(com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Test(org.junit.jupiter.api.Test)

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