Пример #1
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();
 }
Пример #2
0
 private Step failingStepWithEmbeddedScreenshot() throws IOException {
   List<String> jsonReports = new ArrayList<String>();
   jsonReports.add(getAbsolutePathFromResource("net/masterthought/cucumber/embedded_image.json"));
   Feature failingFeatureWithEmbeddedScreenshot =
       new ReportParser(jsonReports).getFeatures().entrySet().iterator().next().getValue().get(0);
   failingFeatureWithEmbeddedScreenshot.processSteps();
   return failingFeatureWithEmbeddedScreenshot.getElements().get(0).getSteps().get(2);
 }
Пример #3
0
  @Before
  public void setUpJsonReports() throws IOException {

    List<String> jsonReports = new ArrayList<String>();
    jsonReports.add(getAbsolutePathFromResource("net/masterthought/cucumber/cells.json"));
    List<Feature> features = new ReportParser(configuration).parseJsonResults(jsonReports);
    Feature feature = features.get(0);
    row = feature.getElements()[0].getSteps()[0].getRows()[0];
  }
Пример #4
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));
 }
Пример #5
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>"));
 }
Пример #6
0
  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);
      }
    }
  }