Beispiel #1
0
  /**
   * Some tests may have not ProcessResult, but are needed to be displayed as not tested test. For
   * each test without ProcessResult, we create a new ProcessResult with NOT_TESTED as the result.
   *
   * @param testList
   * @param themeCode
   * @param netResultList
   * @return
   */
  private Collection<ProcessResult> getProcessResultWithNotTested(
      Collection<Test> testList, Collection<ProcessResult> netResultList) {

    Collection<Test> testedTestList = new ArrayList<Test>();
    for (ProcessResult pr : netResultList) {
      testedTestList.add(pr.getTest());
    }

    Collection<ProcessResult> fullProcessResultList = new ArrayList<ProcessResult>();
    fullProcessResultList.addAll(netResultList);

    for (Test test : testList) {
      // if the test has no ProcessResult and its theme is part of the user
      // selection, a NOT_TESTED result ProcessRemark is created
      if (!testedTestList.contains(test)) {
        ProcessResult pr = processResultFactory.createDefiniteResult();
        pr.setTest(test);
        pr.setValue(TestSolution.NOT_TESTED);
        fullProcessResultList.add(pr);
      }
    }
    return fullProcessResultList;
  }
Beispiel #2
0
  /**
   * To avoid multiple count requests to the db, the audits statistics are computing by iterating
   * through the ProcessResult list. The criterion statistics and the theme statistics are collected
   * on the fly while parsing the collection of ProcessResult
   *
   * @param wrStatistics
   * @return
   */
  private WebResourceStatistics computeAuditStatisticsFromPrList(
      WebResourceStatistics wrStatistics) {

    int nbOfPassed = 0;
    int nbOfFailed = 0;
    int nbOfNmi = 0;
    int nbOfNa = 0;
    int nbOfDetected = 0;
    int nbOfSuspected = 0;
    int nbOfNt = 0;

    for (ProcessResult pr : netResultList) {
      TestSolution prResult = (TestSolution) pr.getValue();
      switch (prResult) {
        case PASSED:
          nbOfPassed++;
          break;
        case FAILED:
          nbOfFailed++;
          break;
        case NOT_APPLICABLE:
          nbOfNa++;
          break;
        case NEED_MORE_INFO:
        case DETECTED:
        case SUSPECTED_FAILED:
        case SUSPECTED_PASSED:
          nbOfNmi++;
          break;
        case NOT_TESTED:
          nbOfNt++;
          break;
      }
      addResultToCriterionCounterMap(prResult, pr.getTest().getCriterion(), wrStatistics);
      addResultToThemeCounterMap(prResult, pr.getTest().getCriterion().getTheme(), wrStatistics);
    }
    // if no test have been processed for any reason, mostly cause the source
    // code couldn't have been adapted, all theses values are set to -1
    if (nbOfFailed + nbOfNa + nbOfNmi + nbOfPassed + nbOfDetected + nbOfSuspected == 0) {
      nbOfFailed = nbOfNa = nbOfNmi = nbOfPassed = nbOfSuspected = nbOfDetected = -1;
    }
    wrStatistics.setNbOfFailed(nbOfFailed);
    wrStatistics.setNbOfInvalidTest(nbOfFailed);
    wrStatistics.setNbOfPassed(nbOfPassed);
    wrStatistics.setNbOfNmi(nbOfNmi);
    wrStatistics.setNbOfNa(nbOfNa);
    wrStatistics.setNbOfDetected(nbOfDetected);
    wrStatistics.setNbOfSuspected(nbOfSuspected);
    wrStatistics.setNbOfNotTested(nbOfNt);

    setWeightedResult(wrStatistics);

    // Compute criterion Result for each criterion and link each
    // criterionStatistics to the current webResourceStatistics
    for (CriterionStatistics cs : csMap.values()) {
      computeCriterionResult(cs);
      wrStatistics.addCriterionStatistics(cs);
    }
    // Link each themeStatistics to the current webResourceStatistics
    for (ThemeStatistics ts : tsMap.values()) {
      wrStatistics.addThemeStatistics(ts);
    }

    wrStatistics.setAudit(audit);
    return wrStatistics;
  }