use of com.epam.ta.reportportal.database.entity.statistics.Statistics 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.Statistics in project commons-dao by reportportal.
the class UpdateStatisticsQueryBuilder method fromItemStatusAware.
public static Update fromItemStatusAware(final TestItem item, boolean isReset) {
Statistics current = item.getStatistics();
int iTotal = current.getExecutionCounter().getPassed() + current.getExecutionCounter().getFailed() + current.getExecutionCounter().getSkipped();
int iPassed = current.getExecutionCounter().getPassed();
int iFailed = current.getExecutionCounter().getFailed();
int iSkipped = current.getExecutionCounter().getSkipped();
Update updateStatusAware = new Update().inc(EXECUTION_COUNTER + ".total", isReset ? iTotal * -1 : iTotal);
if (item.getStatus().awareStatisticsField() != null && !item.getStatus().awareStatisticsField().isEmpty()) {
updateStatusAware = updateStatusAware.inc(EXECUTION_COUNTER + "." + Status.PASSED.awareStatisticsField(), isReset ? iPassed * -1 : iPassed);
updateStatusAware = updateStatusAware.inc(EXECUTION_COUNTER + "." + Status.FAILED.awareStatisticsField(), isReset ? iFailed * -1 : iFailed);
updateStatusAware = updateStatusAware.inc(EXECUTION_COUNTER + "." + Status.SKIPPED.awareStatisticsField(), isReset ? iSkipped * -1 : iSkipped);
}
return updateStatusAware;
}
Aggregations