Exemple #1
0
  /**
   * Find the pending or ignored test outcomes in this set
   *
   * @return A new set of test outcomes containing only the pending or ignored tests
   */
  @SuppressWarnings("unchecked")
  public TestOutcomes getPendingTests() {

    List<TestOutcome> pendingOrSkippedOutcomes = outcomesWithResults(outcomes, PENDING, SKIPPED);
    return TestOutcomes.of(pendingOrSkippedOutcomes)
        .withLabel(labelForTestsWithStatus("pending tests"))
        .withRootOutcomes(getRootOutcomes());
  }
Exemple #2
0
 /**
  * Find the failing test outcomes in this set
  *
  * @return A new set of test outcomes containing only the failing tests
  */
 public TestOutcomes getFailingTests() {
   return TestOutcomes.of(filter(withResult(TestResult.FAILURE), outcomes))
       .withLabel(labelForTestsWithStatus("failing tests"))
       .withRootOutcomes(getRootOutcomes());
 }
Exemple #3
0
 /**
  * Find the successful test outcomes in this set
  *
  * @return A new set of test outcomes containing only the successful tests
  */
 public TestOutcomes getPassingTests() {
   return TestOutcomes.of(filter(withResult(TestResult.SUCCESS), outcomes))
       .withLabel(labelForTestsWithStatus("passing tests"))
       .withRootOutcomes(getRootOutcomes());
 }
Exemple #4
0
 /**
  * Return a copy of the current test outcomes, with test run history and statistics.
  *
  * @return a TestOutcome instance containing a list of TestOutcomeWithHistory instances.
  */
 public TestOutcomes withHistory() {
   return TestOutcomes.of(convert(outcomes, toOutcomesWithHistory()));
 }
Exemple #5
0
 public TestOutcomes withTag(TestTag tag) {
   return TestOutcomes.of(filter(havingTag(tag), outcomes))
       .withLabel(tag.getName())
       .withRootOutcomes(getRootOutcomes());
 }
Exemple #6
0
 /**
  * Find the test outcomes with a given tag name
  *
  * @param tagName the name of the tag type we are filtering on
  * @return A new set of test outcomes for this tag name
  */
 public TestOutcomes withTag(String tagName) {
   return TestOutcomes.of(filter(havingTagName(tagName), outcomes))
       .withLabel(tagName)
       .withRootOutcomes(getRootOutcomes());
 }
Exemple #7
0
 /**
  * Find the test outcomes with a given tag type
  *
  * @param tagType the tag type we are filtering on
  * @return A new set of test outcomes for this tag type
  */
 public TestOutcomes withTagType(String tagType) {
   return TestOutcomes.of(filter(havingTagType(tagType), outcomes))
       .withLabel(tagType)
       .withRootOutcomes(this.getRootOutcomes());
 }
  public void generateReportsForTestResultsIn(TestOutcomes testOutcomes) throws IOException {

    Stopwatch stopwatch = Stopwatch.started();
    LOGGER.info("Generating test results for {} tests", testOutcomes.getTestCount());

    FreemarkerContext context =
        new FreemarkerContext(
            environmentVariables,
            requirements.getRequirementsService(),
            issueTracking,
            relativeLink);

    RequirementsOutcomes requirementsOutcomes =
        requirements.getRequirementsOutcomeFactory().buildRequirementsOutcomesFrom(testOutcomes);

    LOGGER.info(
        "{} requirements loaded after {} ms",
        requirementsOutcomes.getFlattenedRequirementCount(),
        stopwatch.lapTime());

    requirementsOutcomes = requirementsOutcomes.withoutUnrelatedRequirements();

    LOGGER.info(
        "{} related requirements found after {} ms",
        requirementsOutcomes.getFlattenedRequirementCount(),
        stopwatch.lapTime());

    List<String> knownRequirementReportNames =
        requirementReportNamesFrom(requirementsOutcomes, reportNameProvider);

    Set<ReportingTask> reportingTasks = new HashSet<>();

    reportingTasks.add(new CopyResourcesTask());
    reportingTasks.add(new CopyTestResultsTask());
    reportingTasks.add(
        new AggregateReportingTask(
            context,
            environmentVariables,
            requirements.getRequirementsService(),
            getOutputDirectory(),
            testOutcomes));
    reportingTasks.add(
        new TagTypeReportingTask(
            context, environmentVariables, getOutputDirectory(), reportNameProvider, testOutcomes));
    reportingTasks.addAll(
        tagReportsFor(testOutcomes)
            .using(
                context,
                environmentVariables,
                getOutputDirectory(),
                reportNameProvider,
                testOutcomes.getTags(),
                knownRequirementReportNames));

    reportingTasks.addAll(
        ResultReports.resultReportsFor(
            testOutcomes, context, environmentVariables, getOutputDirectory(), reportNameProvider));
    reportingTasks.addAll(
        RequirementsReports.requirementsReportsFor(
            context,
            environmentVariables,
            getOutputDirectory(),
            reportNameProvider,
            requirements.getRequirementsOutcomeFactory(),
            requirements.getRequirementsService(),
            relativeLink,
            testOutcomes,
            requirementsOutcomes));

    LOGGER.info("Starting generating reports: {} ms", stopwatch.lapTime());
    generateReportsFor(reportingTasks);

    LOGGER.info(
        "Finished generating test results for {} tests after {} ms",
        testOutcomes.getTestCount(),
        stopwatch.stop());
  }