/** * @param wrStatistics * @return */ private WebResourceStatistics computeCriterionStatisticsFromDb( WebResourceStatistics wrStatistics) { for (Criterion cr : criterionMap.keySet()) { CriterionStatistics criterionStatistics = criterionStatisticsDataService.create(); criterionStatistics.setCriterion(cr); int nbOfFailed = criterionStatisticsDataService .getResultCountByResultTypeAndCriterion(webResource, TestSolution.FAILED, cr) .intValue(); criterionStatistics.setNbOfFailed(nbOfFailed); int nbOfNa = criterionStatisticsDataService .getResultCountByResultTypeAndCriterion(webResource, TestSolution.NOT_APPLICABLE, cr) .intValue(); criterionStatistics.setNbOfNa(nbOfNa); int nbOfPassed = criterionStatisticsDataService .getResultCountByResultTypeAndCriterion(webResource, TestSolution.PASSED, cr) .intValue(); criterionStatistics.setNbOfPassed(nbOfPassed); int nbOfNmi = criterionStatisticsDataService .getResultCountByResultTypeAndCriterion(webResource, TestSolution.NEED_MORE_INFO, cr) .intValue(); nbOfNmi += criterionStatisticsDataService .getResultCountByResultTypeAndCriterion( webResource, TestSolution.SUSPECTED_FAILED, cr) .intValue(); nbOfNmi += criterionStatisticsDataService .getResultCountByResultTypeAndCriterion( webResource, TestSolution.SUSPECTED_PASSED, cr) .intValue(); nbOfNmi += criterionStatisticsDataService .getResultCountByResultTypeAndCriterion(webResource, TestSolution.DETECTED, cr) .intValue(); criterionStatistics.setNbOfNmi(nbOfNmi); int criterionTestListSize = criterionMap.get(cr); criterionStatistics.setNbOfNotTested( criterionTestListSize * nbOfWr - nbOfFailed - nbOfNa - nbOfNmi - nbOfPassed); computeCriterionResult(criterionStatistics); wrStatistics.addCriterionStatistics(criterionStatistics); } return wrStatistics; }
/** * @param cs * @param testSolution */ private void incrementCriterionCounterFromTestSolution( CriterionStatistics cs, TestSolution testSolution) { switch (testSolution) { case PASSED: cs.setNbOfPassed(cs.getNbOfPassed() + 1); break; case FAILED: cs.setNbOfFailed(cs.getNbOfFailed() + 1); break; case NOT_APPLICABLE: cs.setNbOfNa(cs.getNbOfNa() + 1); break; case NEED_MORE_INFO: case DETECTED: case SUSPECTED_FAILED: case SUSPECTED_PASSED: cs.setNbOfNmi(cs.getNbOfNmi() + 1); break; case NOT_TESTED: cs.setNbOfNotTested(cs.getNbOfNotTested() + 1); break; } }