Search in sources :

Example 71 with StartTestItemRQ

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

the class StaticNestedStepsTest method test_two_static_class_step.

@Test
public void test_two_static_class_step() {
    mockNestedSteps(client, nestedStepLinks);
    TestNG result = runTests(TwoStaticClassSteps.class);
    assertThat(result.getStatus(), equalTo(0));
    ArgumentCaptor<StartTestItemRQ> startNestedStepCapture = ArgumentCaptor.forClass(StartTestItemRQ.class);
    verify(client, times(2)).startTestItem(same(stepUuid), startNestedStepCapture.capture());
    startNestedStepCapture.getAllValues().forEach(i -> {
        assertThat(i.getName(), matchesPattern(ClassStep.class.getSimpleName() + " step \\d"));
        assertThat(i.isHasStats(), equalTo(Boolean.FALSE));
    });
    ArgumentCaptor<FinishTestItemRQ> finishNestedStepCapture = ArgumentCaptor.forClass(FinishTestItemRQ.class);
    verify(client).finishTestItem(same(nestedSteps.get(0)), finishNestedStepCapture.capture());
    verify(client).finishTestItem(same(nestedSteps.get(1)), finishNestedStepCapture.capture());
    finishNestedStepCapture.getAllValues().forEach(i -> assertThat(i.getStatus(), equalTo(ItemStatus.PASSED.name())));
}
Also used : TestNG(org.testng.TestNG) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) FinishTestItemRQ(com.epam.ta.reportportal.ws.model.FinishTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 72 with StartTestItemRQ

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

the class StaticNestedStepsTest method test_static_single_step_with_status.

@Test
public void test_static_single_step_with_status() {
    mockNestedSteps(client, nestedStepLinks.get(0));
    TestNG result = runTests(StaticSingleStepStatus.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(StaticSingleStepStatus.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.INTERRUPTED.name()));
}
Also used : TestNG(org.testng.TestNG) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) FinishTestItemRQ(com.epam.ta.reportportal.ws.model.FinishTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 73 with StartTestItemRQ

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

the class StaticNestedStepsTest method test_named_static_anonymous_step.

@Test
public void test_named_static_anonymous_step() {
    mockNestedSteps(client, nestedStepLinks.get(0));
    TestNG result = runTests(NamedStaticAnonymousStep.class);
    assertThat(result.getStatus(), equalTo(0));
    ArgumentCaptor<StartTestItemRQ> startNestedStepCapture = ArgumentCaptor.forClass(StartTestItemRQ.class);
    verify(client).startTestItem(same(stepUuid), startNestedStepCapture.capture());
    verify(client, times(0)).startTestItem(same(nestedSteps.get(0)), any(StartTestItemRQ.class));
    StartTestItemRQ startStep = startNestedStepCapture.getValue();
    assertThat(startStep.getName(), equalTo(NamedStaticAnonymousStep.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) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) FinishTestItemRQ(com.epam.ta.reportportal.ws.model.FinishTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 74 with StartTestItemRQ

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

the class StepAspect method startNestedStepAnnotation.

@Before(value = "!stepMethod() && (anyMethod() && withStepAnnotation(step))", argNames = "joinPoint,step")
public void startNestedStepAnnotation(JoinPoint joinPoint, Step step) {
    MethodSignature signature = (MethodSignature) joinPoint.getSignature();
    String name = step.value().trim().isEmpty() ? signature.getName() : StepNameUtils.getStepName(step.value(), new TemplateConfiguration(), signature, joinPoint);
    StartTestItemRQ startStepRequest = com.epam.reportportal.aspect.StepRequestUtils.buildStartStepRequest(name, ofNullable(signature.getMethod().getAnnotation(Description.class)).map(Description::value).filter(d -> !d.isEmpty()).orElse(null), signature);
    // noinspection ReactiveStreamsUnusedPublisher
    ofNullable(Launch.currentLaunch()).ifPresent(l -> l.getStepReporter().startNestedStep(startStepRequest));
    ofNullable(startStepRequest.getDescription()).ifPresent(d -> ReportPortal.emitLog(STEP_DESCRIPTION + d, LogLevel.INFO.name(), Calendar.getInstance().getTime()));
}
Also used : Description(io.qameta.allure.Description) MethodSignature(org.aspectj.lang.reflect.MethodSignature) TemplateConfiguration(com.epam.reportportal.utils.templating.TemplateConfiguration) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ)

Example 75 with StartTestItemRQ

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

the class StepBasedSoapUIServiceImpl method startItem.

protected Maybe<String> startItem(String name, TestItemType type, Maybe<String> parentId) {
    if (null != launch) {
        StartTestItemRQ rq = new StartTestItemRQ();
        rq.setName(name);
        rq.setStartTime(Calendar.getInstance().getTime());
        rq.setType(type.getValue());
        return this.launch.startTestItem(parentId, rq);
    } else {
        return Maybe.empty();
    }
}
Also used : StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ)

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