public List<String> getRequirementTypes() { List<String> types = requirements.getTypes(); if (types.isEmpty()) { LOGGER.warn( "No requirement types found in the test outcome requirements: using default requirements"); return requirementsConfiguration.getRequirementTypes(); } else { return types; } }
public HtmlAggregateStoryReporter( final String projectName, final String relativeLink, final IssueTracking issueTracking, final EnvironmentVariables environmentVariables, final Requirements requirements) { this.projectName = projectName; this.relativeLink = relativeLink; this.issueTracking = issueTracking; this.requirementsConfiguration = new RequirementsConfiguration(getEnvironmentVariables()); this.environmentVariables = environmentVariables; this.formatConfiguration = new FormatConfiguration(environmentVariables); this.reportNameProvider = new ReportNameProvider(NO_CONTEXT, ReportType.HTML, requirements.getRequirementsService()); this.requirements = requirements; }
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()); }