Search in sources :

Example 51 with StartTestItemRQ

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

the class MethodNestedStepsTest method test_verify_steps_support_templating_with_self_reference.

@Test
void test_verify_steps_support_templating_with_self_reference() {
    mockNestedSteps(client, nestedStepLinks.get(0));
    runTests(MethodStepTemplate.class);
    ArgumentCaptor<StartTestItemRQ> startNestedStepCapture = ArgumentCaptor.forClass(StartTestItemRQ.class);
    verify(client).startTestItem(same(stepUuid), startNestedStepCapture.capture());
    StartTestItemRQ startStep = startNestedStepCapture.getValue();
    assertThat(startStep.getName(), equalTo(MethodStepTemplate.STEP_TEMPLATE_VALUE.replace("{this.FIELD}", MethodStepTemplate.FIELD).replace("{0}", MethodStepTemplate.PARAMETER)));
}
Also used : StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 52 with StartTestItemRQ

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

the class MethodNestedStepsTest method test_method_single_step.

@Test
public void test_method_single_step() {
    mockNestedSteps(client, nestedStepLinks.get(0));
    TestNG result = runTests(Collections.singletonList(TestNgListener.class), MethodSingleStep.class);
    assertThat(result.getStatus(), equalTo(0));
    ArgumentCaptor<StartTestItemRQ> startNestedStepCapture = ArgumentCaptor.forClass(StartTestItemRQ.class);
    verify(client).startTestItem(same(stepUuid), startNestedStepCapture.capture());
    StartTestItemRQ startStep = startNestedStepCapture.getValue();
    assertThat(startStep.getName(), equalTo(MethodSingleStep.TEST_STEP_NAME));
    assertThat(startStep.isHasStats(), equalTo(Boolean.FALSE));
    ArgumentCaptor<FinishTestItemRQ> finishNestedStepCapture = ArgumentCaptor.forClass(FinishTestItemRQ.class);
    verify(client).finishTestItem(same(nestedSteps.get(0)), finishNestedStepCapture.capture());
    FinishTestItemRQ finishStep = finishNestedStepCapture.getValue();
    assertThat(finishStep.getStatus(), equalTo(ItemStatus.PASSED.name()));
}
Also used : TestNG(org.testng.TestNG) TestNgListener(com.epam.reportportal.testng.util.TestNgListener) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) FinishTestItemRQ(com.epam.ta.reportportal.ws.model.FinishTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 53 with StartTestItemRQ

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

the class MethodNestedStepsTest method test_method_named_single_step.

@Test
public void test_method_named_single_step() {
    mockNestedSteps(client, nestedStepLinks.get(0));
    TestNG result = runTests(Collections.singletonList(TestNgListener.class), MethodNamedSingleStep.class);
    assertThat(result.getStatus(), equalTo(0));
    ArgumentCaptor<StartTestItemRQ> startNestedStepCapture = ArgumentCaptor.forClass(StartTestItemRQ.class);
    verify(client).startTestItem(same(stepUuid), startNestedStepCapture.capture());
    StartTestItemRQ startStep = startNestedStepCapture.getValue();
    assertThat(startStep.getName(), equalTo(MethodNamedSingleStep.TEST_STEP_NAME));
    assertThat(startStep.isHasStats(), equalTo(Boolean.FALSE));
    ArgumentCaptor<FinishTestItemRQ> finishNestedStepCapture = ArgumentCaptor.forClass(FinishTestItemRQ.class);
    verify(client).finishTestItem(same(nestedSteps.get(0)), finishNestedStepCapture.capture());
    FinishTestItemRQ finishStep = finishNestedStepCapture.getValue();
    assertThat(finishStep.getStatus(), equalTo(ItemStatus.PASSED.name()));
}
Also used : TestNG(org.testng.TestNG) TestNgListener(com.epam.reportportal.testng.util.TestNgListener) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) FinishTestItemRQ(com.epam.ta.reportportal.ws.model.FinishTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 54 with StartTestItemRQ

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

the class MutedAnnotationTest method test_muted_annotation_method_level_processing.

@Test
public void test_muted_annotation_method_level_processing() {
    TestNG result = runTests("muted_method_tests.xml");
    assertThat(result.getStatus(), equalTo(0));
    // 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, times(2)).startTestItem(same(testClassUuid), startMethodCapture.capture());
    List<StartTestItemRQ> startMethods = startMethodCapture.getAllValues().stream().filter(rq -> rq.getName().contains("muted")).collect(Collectors.toList());
    assertThat(startMethods, hasSize(1));
    assertThat(startMethods.get(0).isHasStats(), equalTo(Boolean.FALSE));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) BeforeEach(org.junit.jupiter.api.BeforeEach) ReportPortalClient(com.epam.reportportal.service.ReportPortalClient) ReportPortal(com.epam.reportportal.service.ReportPortal) Collectors(java.util.stream.Collectors) Test(org.junit.jupiter.api.Test) TestNgListener(com.epam.reportportal.testng.util.TestNgListener) Mockito(org.mockito.Mockito) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) List(java.util.List) ArgumentCaptor(org.mockito.ArgumentCaptor) Stream(java.util.stream.Stream) TestNG(org.testng.TestNG) 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) ArgumentMatchers.same(org.mockito.ArgumentMatchers.same) TestNG(org.testng.TestNG) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 55 with StartTestItemRQ

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

the class AllureAwareListener method buildSpecItemRq.

@Override
@Nonnull
protected StartTestItemRQ buildSpecItemRq(@Nonnull SpecInfo spec) {
    StartTestItemRQ rq = super.buildSpecItemRq(spec);
    AnnotatedElement c = spec.getReflection();
    processLabels(rq, c);
    processLinks(rq, c);
    return rq;
}
Also used : AnnotatedElement(java.lang.reflect.AnnotatedElement) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Nonnull(javax.annotation.Nonnull)

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