Search in sources :

Example 16 with TestItemResults

use of com.epam.ta.reportportal.entity.item.TestItemResults in project service-api by reportportal.

the class ClusterItemDataProviderMockTest method getTestItemResults.

private TestItemResults getTestItemResults(Long index) {
    final TestItemResults testItemResults = new TestItemResults();
    testItemResults.setDuration(0.01);
    testItemResults.setEndTime(LocalDateTime.now(ZoneOffset.UTC));
    testItemResults.setStatus(StatusEnum.FAILED);
    final IssueEntity issueEntity = getIssueEntity(index);
    testItemResults.setIssue(issueEntity);
    final LinkedHashSet<Statistics> statistics = getStatistics();
    testItemResults.setStatistics(statistics);
    return testItemResults;
}
Also used : IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity) TestItemResults(com.epam.ta.reportportal.entity.item.TestItemResults) Statistics(com.epam.ta.reportportal.entity.statistics.Statistics)

Example 17 with TestItemResults

use of com.epam.ta.reportportal.entity.item.TestItemResults in project service-api by reportportal.

the class FinishTestItemHandlerImpl method processChildItemResult.

private TestItemResults processChildItemResult(TestItem testItem, FinishTestItemRQ finishTestItemRQ, ReportPortalUser user, ReportPortalUser.ProjectDetails projectDetails, Launch launch) {
    TestItemResults testItemResults = testItem.getItemResults();
    StatusEnum actualStatus = fromValue(finishTestItemRQ.getStatus()).orElse(INTERRUPTED);
    Optional<IssueEntity> resolvedIssue = resolveIssue(user, actualStatus, testItem, finishTestItemRQ.getIssue(), projectDetails.getProjectId());
    if (testItemResults.getStatus() == IN_PROGRESS) {
        testItemResults.setStatus(actualStatus);
        resolvedIssue.ifPresent(issue -> updateItemIssue(testItemResults, issue));
        ofNullable(testItem.getRetryOf()).ifPresentOrElse(retryOf -> {
        }, () -> {
            changeStatusHandler.changeParentStatus(testItem, projectDetails.getProjectId(), user);
            changeStatusHandler.changeLaunchStatus(launch);
            if (testItem.isHasRetries()) {
                retryHandler.finishRetries(testItem.getItemId(), JStatusEnum.valueOf(actualStatus.name()), TO_LOCAL_DATE_TIME.apply(finishTestItemRQ.getEndTime()));
            }
        });
    } else {
        updateFinishedItem(testItemResults, actualStatus, resolvedIssue, testItem, user, projectDetails.getProjectId());
    }
    testItem.getAttributes().removeIf(attribute -> ATTRIBUTE_KEY_STATUS.equalsIgnoreCase(attribute.getKey()) && ATTRIBUTE_VALUE_INTERRUPTED.equalsIgnoreCase(attribute.getValue()));
    return testItemResults;
}
Also used : StatusEnum(com.epam.ta.reportportal.entity.enums.StatusEnum) JStatusEnum(com.epam.ta.reportportal.jooq.enums.JStatusEnum) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity) TestItemResults(com.epam.ta.reportportal.entity.item.TestItemResults)

Example 18 with TestItemResults

use of com.epam.ta.reportportal.entity.item.TestItemResults in project commons-dao by reportportal.

the class TestItemRepositoryTest method saveItemWith700CharsTestCaseId.

@Test
void saveItemWith700CharsTestCaseId() {
    String longParam = "pQJlVldHAf4vmEhm9PemBRGjHUCHixdkCfaSpzsPJKWUS29W0wygKgVjiuvu9xe3G4mBcUjjNeOUBqe1ZvM5A9GXYp15NcoVJDrgSBaIJoBdeZId2EEkxGKh0GrL7WMkCAZ36QlzA4JQg52sQgv2S9gdxCc0RteMuau1lxLdzvP8GqRldpvhsYHEBzKhhnes4KcmkLP20zV6nIIj7hdxGRZEPsqKI8vZWcX23P6FQxKtJN3OPVG8wxNekaCAD9e4aOV7XQhHgMk7mx3QCFK4u4KjQv5QF7BKUB4isQM1pMX0gysu6tj5Ss0eWI8Mg6JVb88bm61ByS08indxu7hqefBcLwL3CX6zTAEmeNn2c0BxI06RUFBwZxoa6durIomVhie4JwarzA5dB3qQ9H4UEH6lWqKO95FDH7yYH5CoMDdMCMXwoBnd8Fu61t9KIKrTk06IW1zSaPAPFq00bq2J2cEZk3ybaraMqaNepHX3huw4u7sYxCAXVZnb4COMkXwsFQ5V7ptCiuG4k7ZVgRg1vtQ7WmqbArL86tjGkUSh0f49wkcg2N6eYdBcGC1QNZZoGDQWJzIwydfnoRmGi4Utzt05erQeHa5XpKC05Iii6ZrT6Ib4sZ0QdhCUy8SEuKFxOzcGv7CRenv44Nhv0SdPjEuZ5BEKgAPkIuBknokoOgXAtdL7BFtMwu0IzH7U";
    TestItem item = new TestItem();
    item.setStartTime(LocalDateTime.now());
    item.setName("item");
    item.setPath("1.2.3");
    item.setUniqueId("uniqueID");
    item.setUuid("uuid");
    item.setTestCaseHash(123);
    item.setTestCaseId(longParam);
    TestItemResults itemResults = new TestItemResults();
    itemResults.setTestItem(item);
    itemResults.setStatus(StatusEnum.IN_PROGRESS);
    item.setItemResults(itemResults);
    item.setLaunchId(1L);
    item.setType(TestItemTypeEnum.STEP);
    Parameter parameter = new Parameter();
    item.setParameters(Sets.newLinkedHashSet(parameter));
    testItemRepository.save(item);
}
Also used : Parameter(com.epam.ta.reportportal.entity.item.Parameter) 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) BaseTest(com.epam.ta.reportportal.BaseTest) Test(org.junit.jupiter.api.Test)

Example 19 with TestItemResults

use of com.epam.ta.reportportal.entity.item.TestItemResults in project commons-dao by reportportal.

the class TestItemRepositoryTest method saveItemWith700CharsParam.

@Test
void saveItemWith700CharsParam() {
    String longParam = "pQJlVldHAf4vmEhm9PemBRGjHUCHixdkCfaSpzsPJKWUS29W0wygKgVjiuvu9xe3G4mBcUjjNeOUBqe1ZvM5A9GXYp15NcoVJDrgSBaIJoBdeZId2EEkxGKh0GrL7WMkCAZ36QlzA4JQg52sQgv2S9gdxCc0RteMuau1lxLdzvP8GqRldpvhsYHEBzKhhnes4KcmkLP20zV6nIIj7hdxGRZEPsqKI8vZWcX23P6FQxKtJN3OPVG8wxNekaCAD9e4aOV7XQhHgMk7mx3QCFK4u4KjQv5QF7BKUB4isQM1pMX0gysu6tj5Ss0eWI8Mg6JVb88bm61ByS08indxu7hqefBcLwL3CX6zTAEmeNn2c0BxI06RUFBwZxoa6durIomVhie4JwarzA5dB3qQ9H4UEH6lWqKO95FDH7yYH5CoMDdMCMXwoBnd8Fu61t9KIKrTk06IW1zSaPAPFq00bq2J2cEZk3ybaraMqaNepHX3huw4u7sYxCAXVZnb4COMkXwsFQ5V7ptCiuG4k7ZVgRg1vtQ7WmqbArL86tjGkUSh0f49wkcg2N6eYdBcGC1QNZZoGDQWJzIwydfnoRmGi4Utzt05erQeHa5XpKC05Iii6ZrT6Ib4sZ0QdhCUy8SEuKFxOzcGv7CRenv44Nhv0SdPjEuZ5BEKgAPkIuBknokoOgXAtdL7BFtMwu0IzH7U";
    TestItem item = new TestItem();
    item.setStartTime(LocalDateTime.now());
    item.setName("item");
    item.setPath("1.2.3");
    item.setUniqueId("uniqueID");
    item.setUuid("uuid");
    item.setTestCaseHash(123);
    TestItemResults itemResults = new TestItemResults();
    itemResults.setTestItem(item);
    itemResults.setStatus(StatusEnum.IN_PROGRESS);
    item.setItemResults(itemResults);
    item.setLaunchId(1L);
    item.setType(TestItemTypeEnum.STEP);
    Parameter parameter = new Parameter();
    parameter.setKey(longParam);
    parameter.setValue(longParam);
    item.setParameters(Sets.newLinkedHashSet(parameter));
    testItemRepository.save(item);
}
Also used : Parameter(com.epam.ta.reportportal.entity.item.Parameter) 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) BaseTest(com.epam.ta.reportportal.BaseTest) Test(org.junit.jupiter.api.Test)

Example 20 with TestItemResults

use of com.epam.ta.reportportal.entity.item.TestItemResults in project service-api by reportportal.

the class FinishLaunchHierarchyHandlerTest method getTestItemsWithoutChildren.

private List<TestItem> getTestItemsWithoutChildren(Launch launch) {
    TestItem firstChild = new TestItem();
    firstChild.setItemId(3L);
    firstChild.setType(TestItemTypeEnum.STEP);
    firstChild.setLaunchId(launch.getId());
    firstChild.setPath("1.2.3");
    firstChild.setHasStats(true);
    firstChild.setHasChildren(false);
    TestItemResults parentResults = new TestItemResults();
    parentResults.setStatus(StatusEnum.IN_PROGRESS);
    firstChild.setItemResults(parentResults);
    TestItem secondChild = new TestItem();
    secondChild.setItemId(4L);
    secondChild.setType(TestItemTypeEnum.STEP);
    secondChild.setLaunchId(launch.getId());
    secondChild.setPath("1.2.4");
    secondChild.setHasStats(true);
    secondChild.setHasChildren(true);
    TestItemResults childResults = new TestItemResults();
    childResults.setStatus(StatusEnum.IN_PROGRESS);
    secondChild.setItemResults(childResults);
    return Lists.newArrayList(firstChild, secondChild);
}
Also used : TestItemResults(com.epam.ta.reportportal.entity.item.TestItemResults) TestItem(com.epam.ta.reportportal.entity.item.TestItem)

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