use of com.epam.ta.reportportal.database.entity.statistics.IssueCounter in project commons-dao by reportportal.
the class TestItemRepositoryTest method updateExecutionStatisticsTest.
@Test
public void updateExecutionStatisticsTest() {
final TestItem testItem = new TestItem();
testItem.setStatistics(new Statistics(new ExecutionCounter(2, 2, 0, 0), new IssueCounter()));
testItem.setStatus(Status.PASSED);
testItemRepository.save(testItem);
testItemRepository.updateExecutionStatistics(testItem);
final TestItem item = testItemRepository.findOne(testItem.getId());
final ExecutionCounter executionCounter = item.getStatistics().getExecutionCounter();
assertThat(executionCounter.getTotal()).isEqualTo(3);
assertThat(executionCounter.getFailed()).isEqualTo(0);
assertThat(executionCounter.getPassed()).isEqualTo(3);
assertThat(executionCounter.getSkipped()).isEqualTo(0);
}
use of com.epam.ta.reportportal.database.entity.statistics.IssueCounter in project commons-dao by reportportal.
the class UpdateStatisticsQueryBuilder method fromIssueTypeAware.
/**
* Complex update operator for MongoDB with positive or negative increment
* for all defined issue sub-types of specified test item.
*
* upd: since there are different methods for incrementing, this is used
* only for deleting item's statistics.
*
* @param item
* @return Update
*/
/* DELETE methods in old statistics */
public static Update fromIssueTypeAware(final TestItem item) {
IssueCounter issueCounter = item.getStatistics().getIssueCounter();
/* MongoDB Update object instance initialization */
Update issueStatusAware = new Update();
issueCounter.getAutomationBug().forEach((k, v) -> decreaseIssueCounter(issueStatusAware, AUTOMATION_BUG.awareStatisticsField(), k, v));
issueCounter.getProductBug().forEach((k, v) -> decreaseIssueCounter(issueStatusAware, PRODUCT_BUG.awareStatisticsField(), k, v));
issueCounter.getSystemIssue().forEach((k, v) -> decreaseIssueCounter(issueStatusAware, SYSTEM_ISSUE.awareStatisticsField(), k, v));
issueCounter.getNoDefect().forEach((k, v) -> decreaseIssueCounter(issueStatusAware, NO_DEFECT.awareStatisticsField(), k, v));
issueCounter.getToInvestigate().forEach((k, v) -> decreaseIssueCounter(issueStatusAware, TO_INVESTIGATE.awareStatisticsField(), k, v));
return issueStatusAware;
}
Aggregations