예제 #1
0
 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;
 }
예제 #2
0
 @Test
 public void shouldReturnRows() throws IOException {
   List<String> jsonReports = new ArrayList<String>();
   jsonReports.add(getAbsolutePathFromResource("net/masterthought/cucumber/cells.json"));
   ReportParser reportParser = new ReportParser(jsonReports);
   Feature feature = reportParser.getFeatures().entrySet().iterator().next().getValue().get(0);
   Step step = feature.getElements().get(0).getSteps().get(0);
   feature.processSteps();
   assertThat(step.getRows()[0], is(Row.class));
 }
예제 #3
0
 @Test
 public void shouldReturnRowsWhenNoResultsForStep() throws IOException {
   List<String> jsonReports = new ArrayList<String>();
   jsonReports.add(
       getAbsolutePathFromResource("net/masterthought/cucumber/with_no_step_results.json"));
   ReportParser reportParser = new ReportParser(jsonReports);
   Feature feature = reportParser.getFeatures().entrySet().iterator().next().getValue().get(0);
   Step step = feature.getElements().get(0).getSteps().get(0);
   feature.processSteps();
   assertThat(
       step.getName(),
       is(
           "<div class=\"missing\"><span class=\"step-keyword\">Given  </span><span class=\"step-name\">a &quot;Big&quot; customer</span><span class=\"step-duration\"></span><div class=\"step-error-message\"><pre class=\"step-error-message-content\"><span class=\"missing\">Result was missing for this step</span></pre></div></div>"));
 }
예제 #4
0
 @Before
 public void setUpJsonReports() throws IOException {
   List<String> jsonReports = new ArrayList<String>();
   jsonReports.add(getAbsolutePathFromResource("net/masterthought/cucumber/project1.json"));
   ReportParser reportParser = new ReportParser(jsonReports);
   Feature passingFeature =
       reportParser.getFeatures().entrySet().iterator().next().getValue().get(0);
   Feature failingFeature =
       reportParser.getFeatures().entrySet().iterator().next().getValue().get(1);
   passingFeature.processSteps();
   failingFeature.processSteps();
   passingStep = passingFeature.getElements().first().getSteps().first();
   failingStep = failingFeature.getElements().first().getSteps().get(5);
   skippedStep = failingFeature.getElements().first().getSteps().get(6);
   withOutput = passingFeature.getElements().get(1).getSteps().first();
 }
 @Test
 public void shouldDisplayArtifacts() throws Exception {
   ConfigurationOptions.setArtifactsEnabled(true);
   String configuration =
       "Account has sufficient funds again~the account balance is 300~balance~account_balance.txt~xml";
   ArtifactProcessor artifactProcessor = new ArtifactProcessor(configuration);
   Map<String, Artifact> map = artifactProcessor.process();
   ConfigurationOptions.setArtifactConfiguration(map);
   reportInformation = new ReportInformation(reportParser.getFeatures());
   assertThat(
       reportInformation.getFeatures().get(2).getElements().get(7).getSteps().get(0).getName(),
       is(
           "<div class=\"passed\"><span class=\"step-keyword\">Given  </span><span class=\"step-name\">the account <div style=\"display:none;\"><textarea id=\"Account_has_sufficient_funds_againthe_account_balance_is_300\" class=\"brush: xml;\"></textarea></div><a onclick=\"applyArtifact('Account_has_sufficient_funds_againthe_account_balance_is_300','account_balance.txt')\" href=\"#\">balance</a> is 300</span><span class=\"step-duration\">0 ms</span></div>"));
 }
 @Before
 public void setUpReportInformation() throws IOException, URISyntaxException {
   ConfigurationOptions.setSkippedFailsBuild(false);
   ConfigurationOptions.setUndefinedFailsBuild(false);
   List<String> jsonReports = new ArrayList<String>();
   // will work iff the resources are not jarred up, otherwise use IOUtils to copy to a temp file.
   jsonReports.add(
       new File(
               ReportInformationTest.class
                   .getClassLoader()
                   .getResource("net/masterthought/cucumber/project1.json")
                   .toURI())
           .getAbsolutePath());
   jsonReports.add(
       new File(
               ReportInformationTest.class
                   .getClassLoader()
                   .getResource("net/masterthought/cucumber/project2.json")
                   .toURI())
           .getAbsolutePath());
   reportParser = new ReportParser(jsonReports);
   reportInformation = new ReportInformation(reportParser.getFeatures());
 }