Search in sources :

Example 76 with StartTestItemRQ

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

the class StepBasedSoapUIServiceImpl method startTestStep.

public void startTestStep(TestStep testStep, TestCaseRunContext context) {
    if (null != launch) {
        if (testStep.getPropertyValue(ID) != null) {
            return;
        }
        this.context.setTestCanceled(false);
        StartTestItemRQ rq = new StartTestItemRQ();
        rq.setName(testStep.getName());
        rq.setDescription(TestStepType.getStepType(testStep.getClass()));
        rq.setStartTime(Calendar.getInstance().getTime());
        rq.setType(TestItemType.TEST_STEP.getValue());
        Maybe<String> rs = this.launch.startTestItem(fromStringId(testStep.getTestCase().getPropertyValue(ID)), rq);
        context.setProperty(ID, rs);
    }
}
Also used : StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ)

Example 77 with StartTestItemRQ

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

the class StepBasedSoapUIServiceImpl method startTestSuite.

public void startTestSuite(TestSuite testSuite) {
    if (null != launch) {
        StartTestItemRQ rq = new StartTestItemRQ();
        rq.setName(testSuite.getName());
        rq.setStartTime(Calendar.getInstance().getTime());
        rq.setType(TestItemType.TEST_SUITE.getValue());
        Maybe<String> rs = this.launch.startTestItem(rq);
        testSuite.setPropertyValue(ID, toStringId(rs));
    }
}
Also used : StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ)

Example 78 with StartTestItemRQ

use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project service-api by reportportal.

the class RerunHandlerImplTest method happyRerunChildItem.

@Test
void happyRerunChildItem() {
    StartTestItemRQ request = new StartTestItemRQ();
    request.setLaunchUuid("launch_uuid");
    request.setType("STEP");
    String itemName = "name";
    request.setName(itemName);
    final String testCaseId = "caseId";
    request.setTestCaseId(testCaseId);
    Launch launch = getLaunch("uuid");
    TestItem parent = new TestItem();
    parent.setItemId(2L);
    parent.setPath("1.2");
    final TestItem item = getItem(itemName, launch);
    when(rerunSearcher.findItem(any(Queryable.class))).thenReturn(Optional.of(item.getItemId()));
    when(testItemRepository.findById(item.getItemId())).thenReturn(Optional.of(item));
    when(testItemRepository.selectPath("uuid")).thenReturn(Optional.of(Pair.of(parent.getItemId(), parent.getPath())));
    when(testItemRepository.findIdByUuidForUpdate("uuid")).thenReturn(Optional.of(parent.getItemId()));
    when(testItemRepository.getOne(parent.getItemId())).thenReturn(parent);
    Optional<ItemCreatedRS> rerunCreatedRS = rerunHandler.handleChildItem(request, launch, "uuid");
    verify(retryHandler, times(1)).handleRetries(any(), any(), any());
    assertTrue(rerunCreatedRS.isPresent());
}
Also used : Queryable(com.epam.ta.reportportal.commons.querygen.Queryable) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Launch(com.epam.ta.reportportal.entity.launch.Launch) ItemCreatedRS(com.epam.ta.reportportal.ws.model.item.ItemCreatedRS) TestItem(com.epam.ta.reportportal.entity.item.TestItem) Test(org.junit.jupiter.api.Test)

Example 79 with StartTestItemRQ

use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project service-api by reportportal.

the class RerunHandlerImplTest method returnEmptyOptionalWhenChildItemNotFound.

@Test
void returnEmptyOptionalWhenChildItemNotFound() {
    StartTestItemRQ request = new StartTestItemRQ();
    request.setLaunchUuid("launch_uuid");
    request.setType("STEP");
    String itemName = "name";
    request.setName(itemName);
    final String testCaseId = "caseId";
    request.setTestCaseId(testCaseId);
    Launch launch = getLaunch("uuid");
    TestItem parent = new TestItem();
    parent.setItemId(2L);
    parent.setPath("1.2");
    when(rerunSearcher.findItem(any(Queryable.class))).thenReturn(Optional.empty());
    when(testItemRepository.selectPath("uuid")).thenReturn(Optional.of(Pair.of(parent.getItemId(), parent.getPath())));
    Optional<ItemCreatedRS> rerunCreatedRS = rerunHandler.handleChildItem(request, launch, "uuid");
    assertFalse(rerunCreatedRS.isPresent());
}
Also used : Queryable(com.epam.ta.reportportal.commons.querygen.Queryable) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Launch(com.epam.ta.reportportal.entity.launch.Launch) ItemCreatedRS(com.epam.ta.reportportal.ws.model.item.ItemCreatedRS) TestItem(com.epam.ta.reportportal.entity.item.TestItem) Test(org.junit.jupiter.api.Test)

Example 80 with StartTestItemRQ

use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project service-api by reportportal.

the class StartTestItemHandlerImplTest method startRootItemUnderLaunchFromAnotherProject.

@Test
void startRootItemUnderLaunchFromAnotherProject() {
    final ReportPortalUser rpUser = getRpUser("test", UserRole.USER, ProjectRole.MEMBER, 1L);
    StartTestItemRQ startTestItemRQ = new StartTestItemRQ();
    startTestItemRQ.setLaunchUuid("1");
    startTestItemRQ.setStartTime(Date.from(LocalDateTime.now().atZone(ZoneId.of("UTC")).toInstant()));
    final Launch launch = getLaunch(2L, StatusEnum.IN_PROGRESS);
    launch.setStartTime(LocalDateTime.now().minusHours(1));
    when(launchRepository.findByUuid("1")).thenReturn(Optional.of(launch));
    final ReportPortalException exception = assertThrows(ReportPortalException.class, () -> handler.startRootItem(rpUser, extractProjectDetails(rpUser, "test_project"), startTestItemRQ));
    assertEquals("You do not have enough permissions.", exception.getMessage());
}
Also used : ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) ReportPortalUser(com.epam.ta.reportportal.commons.ReportPortalUser) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Launch(com.epam.ta.reportportal.entity.launch.Launch) 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