use of com.epam.ta.reportportal.entity.item.TestItemResults in project service-api by reportportal.
the class AnalyzerServiceServiceTest method testItemsTI.
private List<TestItem> testItemsTI(int count) {
List<TestItem> list = new ArrayList<>(count);
for (int i = 1; i <= count; i++) {
TestItem test = new TestItem();
test.setItemId((long) i);
test.setName("test" + i);
test.setUniqueId("unique" + i);
test.setItemResults(new TestItemResults());
test.getItemResults().setIssue(issueToInvestigate());
test.getItemResults().setStatus(StatusEnum.FAILED);
list.add(test);
}
return list;
}
use of com.epam.ta.reportportal.entity.item.TestItemResults in project service-api by reportportal.
the class TestItemBuilder method addStartItemRequest.
public TestItemBuilder addStartItemRequest(StartTestItemRQ rq) {
testItem.setStartTime(EntityUtils.TO_LOCAL_DATE_TIME.apply(rq.getStartTime()));
testItem.setName(rq.getName().trim());
testItem.setUniqueId(rq.getUniqueId());
testItem.setUuid(Optional.ofNullable(rq.getUuid()).orElse(UUID.randomUUID().toString()));
testItem.setHasStats(rq.isHasStats());
TestCaseIdEntry testCaseIdEntry = processTestCaseId(rq);
testItem.setTestCaseId(testCaseIdEntry.getId());
testItem.setTestCaseHash(testCaseIdEntry.getHash());
testItem.setCodeRef(rq.getCodeRef());
TestItemResults testItemResults = new TestItemResults();
testItemResults.setStatus(StatusEnum.IN_PROGRESS);
testItemResults.setTestItem(testItem);
testItem.setItemResults(testItemResults);
addDescription(rq.getDescription());
addParameters(rq.getParameters());
addType(rq.getType());
return this;
}
use of com.epam.ta.reportportal.entity.item.TestItemResults in project service-api by reportportal.
the class TestItemBuilderTest method addResultsTest.
@Test
void addResultsTest() {
TestItem item = new TestItem();
final LocalDateTime now = LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS);
item.setStartTime(now);
final TestItemResults itemResults = new TestItemResults();
itemResults.setEndTime(now.plusSeconds(120));
item.setItemResults(itemResults);
final ItemAttribute systemAttribute = new ItemAttribute("key", "val", true);
item.setAttributes(Sets.newHashSet(new ItemAttribute("key", "val", false), systemAttribute));
final TestItem resultItem = new TestItemBuilder(item).addTestItemResults(itemResults).addStatus(StatusEnum.PASSED).overwriteAttributes(Sets.newHashSet(new ItemAttributeResource("k", "v"))).get();
assertEquals(120, resultItem.getItemResults().getDuration(), 0.1);
assertEquals(StatusEnum.PASSED, resultItem.getItemResults().getStatus());
assertThat(resultItem.getAttributes()).containsExactlyInAnyOrder(systemAttribute, new ItemAttribute("k", "v", false));
}
use of com.epam.ta.reportportal.entity.item.TestItemResults in project service-api by reportportal.
the class PredicatesTest method checkTIIndexed.
@Test
void checkTIIndexed() {
TestItem testItem = new TestItem();
final TestItemResults itemResults = new TestItemResults();
testItem.setType(TestItemTypeEnum.STEP);
final IssueEntity issue = new IssueEntity();
final IssueType issueType = new IssueType();
issueType.setIssueGroup(new IssueGroup(TestItemIssueGroup.TO_INVESTIGATE));
issueType.setLocator(TestItemIssueGroup.TO_INVESTIGATE.getLocator());
issue.setIssueType(issueType);
itemResults.setIssue(issue);
testItem.setItemResults(itemResults);
assertTrue(ITEM_CAN_BE_INDEXED.test(testItem), "Item with TI issue is available for indexing");
}
use of com.epam.ta.reportportal.entity.item.TestItemResults in project service-api by reportportal.
the class PredicatesTest method checkIgnoreIndexed.
@Test
void checkIgnoreIndexed() {
TestItem testItem = new TestItem();
testItem.setType(TestItemTypeEnum.STEP);
final TestItemResults itemResults = new TestItemResults();
final IssueEntity issueEntity = new IssueEntity();
issueEntity.setIgnoreAnalyzer(true);
final IssueType issueType = new IssueType();
issueType.setIssueGroup(new IssueGroup(TestItemIssueGroup.PRODUCT_BUG));
issueEntity.setIssueType(issueType);
itemResults.setIssue(issueEntity);
testItem.setItemResults(itemResults);
assertFalse(ITEM_CAN_BE_INDEXED.test(testItem), "Item with ignore flag shouldn't be available for indexing");
}
Aggregations