use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project service-api by reportportal.
the class TestItemControllerValidationTest method startChildTestItemShouldReturnErrorWhenNameIsEmpty.
@Test
public void startChildTestItemShouldReturnErrorWhenNameIsEmpty() throws Exception {
// GIVEN
StartTestItemRQ startTestItemRQ = prepareTestItem();
startTestItemRQ.setName(EMPTY);
// WHEN
MvcResult mvcResult = mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + ITEM_PATH + PARENT_ID_PATH).with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(startTestItemRQ)).contentType(APPLICATION_JSON)).andExpect(status().isBadRequest()).andReturn();
// THEN
ErrorRS error = objectMapper.readValue(mvcResult.getResponse().getContentAsString(), ErrorRS.class);
assertEquals(INCORRECT_REQUEST, error.getErrorType());
assertEquals(INCORRECT_REQUEST_MESSAGE + "[" + FIELD_NAME_IS_BLANK_MESSAGE + " " + FIELD_NAME_SIZE_MESSAGE + "] ", error.getMessage());
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project service-api by reportportal.
the class TestItemBuilderTest method testCaseIdGeneratedFromCodeRefAndParamsTest.
@Test
void testCaseIdGeneratedFromCodeRefAndParamsTest() {
StartTestItemRQ request = new StartTestItemRQ();
request.setName("item");
request.setType("step");
String codeRef = "com.epam.ta.reportportal.core.item.identity.TestCaseIdHandlerImplTest";
request.setCodeRef(codeRef);
ParameterResource param1 = new ParameterResource();
param1.setKey("key1");
String value1 = "value1";
param1.setValue(value1);
ParameterResource param2 = new ParameterResource();
param2.setKey("key2");
String value2 = "value2";
param2.setValue(value2);
ParameterResource param3 = new ParameterResource();
param1.setKey("key3");
request.setParameters(Lists.newArrayList(param1, param2, param3));
TestItem item = new TestItemBuilder().addStartItemRequest(request).get();
String expected = codeRef + "[" + value1 + "," + value2 + ",null]";
assertEquals(expected, item.getTestCaseId());
assertEquals(expected.hashCode(), item.getTestCaseHash());
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project service-api by reportportal.
the class TestItemBuilderTest method addStartRqTest.
@Test
void addStartRqTest() {
final StartTestItemRQ rq = new StartTestItemRQ();
rq.setType("step");
final ParameterResource parameterResource = new ParameterResource();
parameterResource.setKey("key");
parameterResource.setValue("value");
rq.setParameters(Collections.singletonList(parameterResource));
final String uuid = "uuid";
rq.setUniqueId(uuid);
final String description = "description";
rq.setDescription(description);
final LocalDateTime now = LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS);
rq.setStartTime(TO_DATE.apply(now));
final String name = "name";
rq.setName(name);
final TestItem testItem = new TestItemBuilder().addStartItemRequest(rq).get();
assertEquals(TestItemTypeEnum.STEP, testItem.getType());
final Parameter param = new Parameter();
param.setKey("key");
param.setValue("value");
assertTrue(testItem.getParameters().contains(param));
assertEquals(uuid, testItem.getUniqueId());
assertEquals(description, testItem.getDescription());
assertEquals(now, testItem.getStartTime());
assertEquals(name, testItem.getName());
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project service-api by reportportal.
the class StartTestItemHandlerAsyncImplTest method startRootItem.
@Test
void startRootItem() {
StartTestItemRQ request = new StartTestItemRQ();
ReportPortalUser user = getRpUser("test", UserRole.ADMINISTRATOR, ProjectRole.PROJECT_MANAGER, 1L);
startTestItemHandlerAsync.startRootItem(user, user.getProjectDetails().get("test_project"), request);
verify(amqpTemplate).convertAndSend(any(), any(), any(), any());
verify(reportingQueueService).getReportingQueueKey(any());
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project service-api by reportportal.
the class StartTestItemHandlerAsyncImplTest method startChildItem.
@Test
void startChildItem() {
StartTestItemRQ request = new StartTestItemRQ();
ReportPortalUser user = getRpUser("test", UserRole.ADMINISTRATOR, ProjectRole.PROJECT_MANAGER, 1L);
startTestItemHandlerAsync.startChildItem(user, user.getProjectDetails().get("test_project"), request, "123");
verify(amqpTemplate).convertAndSend(any(), any(), any(), any());
verify(reportingQueueService).getReportingQueueKey(any());
}
Aggregations