public ReportBuilder( List<String> jsonReports, File reportDirectory, String pluginUrlPath, String buildNumber, String buildProject, boolean skippedFails, boolean undefinedFails, boolean flashCharts, boolean runWithJenkins, boolean artifactsEnabled, String artifactConfig) throws Exception { ConfigurationOptions.setSkippedFailsBuild(skippedFails); ConfigurationOptions.setUndefinedFailsBuild(undefinedFails); ConfigurationOptions.setArtifactsEnabled(artifactsEnabled); if (artifactsEnabled) { ArtifactProcessor artifactProcessor = new ArtifactProcessor(artifactConfig); ConfigurationOptions.setArtifactConfiguration(artifactProcessor.process()); } ReportParser reportParser = new ReportParser(jsonReports); this.ri = new ReportInformation(reportParser.getFeatures()); this.reportDirectory = reportDirectory; this.buildNumber = buildNumber; this.buildProject = buildProject; this.pluginUrlPath = getPluginUrlPath(pluginUrlPath); this.flashCharts = flashCharts; this.runWithJenkins = runWithJenkins; this.artifactsEnabled = artifactsEnabled; }
public void generateFeatureReports() throws Exception { Iterator<Map.Entry<String, List<Feature>>> it = ri.getProjectFeatureMap().entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, List<Feature>> pairs = it.next(); List<Feature> featureList = (List<Feature>) pairs.getValue(); for (Feature feature : featureList) { VelocityEngine ve = new VelocityEngine(); ve.init(getProperties()); Template featureResult = ve.getTemplate("templates/featureReport.vm"); VelocityContext context = new VelocityContext(); context.put("feature", feature); context.put("report_status_colour", ri.getReportStatusColour(feature)); context.put("build_project", buildProject); context.put("build_number", buildNumber); context.put("scenarios", feature.getElements()); context.put("time_stamp", ri.timeStamp()); context.put("jenkins_base", pluginUrlPath); context.put("fromJenkins", runWithJenkins); context.put("artifactsEnabled", ConfigurationOptions.artifactsEnabled()); generateReport(feature.getFileName(), featureResult, context); } } }