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);
}
}
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));
}
}
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());
}
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());
}
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());
}
Aggregations