Search in sources :

Example 1 with TestItemResults

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;
}
Also used : TestItemResults(com.epam.ta.reportportal.entity.item.TestItemResults) TestItem(com.epam.ta.reportportal.entity.item.TestItem) IndexTestItem(com.epam.ta.reportportal.ws.model.analyzer.IndexTestItem)

Example 2 with TestItemResults

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;
}
Also used : TestItemResults(com.epam.ta.reportportal.entity.item.TestItemResults)

Example 3 with TestItemResults

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));
}
Also used : LocalDateTime(java.time.LocalDateTime) ItemAttributeResource(com.epam.ta.reportportal.ws.model.attribute.ItemAttributeResource) ItemAttribute(com.epam.ta.reportportal.entity.ItemAttribute) TestItemResults(com.epam.ta.reportportal.entity.item.TestItemResults) TestItem(com.epam.ta.reportportal.entity.item.TestItem) Test(org.junit.jupiter.api.Test)

Example 4 with TestItemResults

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");
}
Also used : TestItemIssueGroup(com.epam.ta.reportportal.entity.enums.TestItemIssueGroup) IssueGroup(com.epam.ta.reportportal.entity.item.issue.IssueGroup) IssueType(com.epam.ta.reportportal.entity.item.issue.IssueType) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity) TestItemResults(com.epam.ta.reportportal.entity.item.TestItemResults) TestItem(com.epam.ta.reportportal.entity.item.TestItem) Test(org.junit.jupiter.api.Test)

Example 5 with TestItemResults

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");
}
Also used : TestItemIssueGroup(com.epam.ta.reportportal.entity.enums.TestItemIssueGroup) IssueGroup(com.epam.ta.reportportal.entity.item.issue.IssueGroup) IssueType(com.epam.ta.reportportal.entity.item.issue.IssueType) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity) TestItemResults(com.epam.ta.reportportal.entity.item.TestItemResults) TestItem(com.epam.ta.reportportal.entity.item.TestItem) Test(org.junit.jupiter.api.Test)

Aggregations

TestItemResults (com.epam.ta.reportportal.entity.item.TestItemResults)34 TestItem (com.epam.ta.reportportal.entity.item.TestItem)29 Test (org.junit.jupiter.api.Test)18 ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)14 Launch (com.epam.ta.reportportal.entity.launch.Launch)13 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)10 IssueEntity (com.epam.ta.reportportal.entity.item.issue.IssueEntity)8 ReportPortalUserUtil.getRpUser (com.epam.ta.reportportal.ReportPortalUserUtil.getRpUser)7 IssueType (com.epam.ta.reportportal.entity.item.issue.IssueType)7 User (com.epam.ta.reportportal.entity.user.User)7 StatusEnum (com.epam.ta.reportportal.entity.enums.StatusEnum)6 ItemAttribute (com.epam.ta.reportportal.entity.ItemAttribute)5 IssueGroup (com.epam.ta.reportportal.entity.item.issue.IssueGroup)5 Statistics (com.epam.ta.reportportal.entity.statistics.Statistics)5 FinishTestItemRQ (com.epam.ta.reportportal.ws.model.FinishTestItemRQ)5 OperationCompletionRS (com.epam.ta.reportportal.ws.model.OperationCompletionRS)5 TestItemIssueGroup (com.epam.ta.reportportal.entity.enums.TestItemIssueGroup)4 Parameter (com.epam.ta.reportportal.entity.item.Parameter)4 MessageBus (com.epam.ta.reportportal.core.events.MessageBus)3 StatusChangingStrategy (com.epam.ta.reportportal.core.item.impl.status.StatusChangingStrategy)3