Esempio n. 1
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));
 }
Esempio n. 2
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>"));
 }
Esempio n. 3
0
 @Test
 public void shouldReturnName() {
   assertThat(
       passingStep.getName(),
       is(
           "<div class=\"passed\"><span class=\"step-keyword\">Given  </span><span class=\"step-name\">I have a new credit card</span><span class=\"step-duration\">107ms</span></div>"));
 }
Esempio n. 4
0
 @Test
 public void shouldReturnNameWhenStepSkipped() {
   ConfigurationOptions.instance().setSkippedFailsBuild(false);
   assertThat(
       skippedStep.getName(),
       is(
           "<div class=\"skipped\"><span class=\"step-keyword\">And  </span><span class=\"step-name\">the card should be returned</span><span class=\"step-duration\">000ms</span></div>"));
 }
 @Test
 public void shouldFormatDocString() {
   assertThat(
       step.getDocString(),
       is(
           "<div class=\"passed\">"
               + "<div class=\"doc-string\">"
               + "X&nbsp;_&nbsp;X<br/>"
               + "O&nbsp;X&nbsp;O<br/>"
               + "_&nbsp;O&nbsp;X"
               + "</div>"
               + "</div>"));
 }
Esempio n. 6
0
 @Test
 public void shouldReturnNameWhenConfigSkippedTurnedOn() {
   ConfigurationOptions configuration = ConfigurationOptions.instance();
   configuration.setSkippedFailsBuild(true);
   try {
     assertThat(
         skippedStep.getName(),
         is(
             "<div class=\"skipped\"><span class=\"step-keyword\">And  </span><span class=\"step-name\">the card should be returned</span><span class=\"step-duration\">000ms</span></div>"));
   } finally {
     // restore the initial state for next tests
     configuration.setSkippedFailsBuild(false);
   }
 }
Esempio n. 7
0
 @Test
 public void shouldReturnDataTableClass() {
   assertThat(passingStep.getDataTableClass(), is("passed"));
   assertThat(failingStep.getDataTableClass(), is("failed"));
 }
Esempio n. 8
0
 @Test
 public void shouldReturnDuration() {
   assertThat(passingStep.getDuration(), is(107447000L));
 }
Esempio n. 9
0
 @Test
 public void shouldReturnStatus() {
   assertThat(passingStep.getStatus(), is(Status.PASSED));
   assertThat(failingStep.getStatus(), is(Status.FAILED));
 }
Esempio n. 10
0
 @Test
 public void shouldReturnOutput() {
   assertThat(withOutput.getOutput(), is("<div>some other text</div><div>wooops</div>"));
 }
Esempio n. 11
0
 @Test
 public void shouldKnowIfHasRows() {
   assertThat(passingStep.hasRows(), is(false));
 }
Esempio n. 12
0
 @Test
 public void shouldNotCreateLinkToScreenshotWhenOneDoesNotExist() throws IOException {
   long screenshotTime = new DateTime().getMillis();
   DateTimeUtils.setCurrentMillisFixed(screenshotTime);
   assertThat(failingStep.getImageTags(), is(EMPTY));
 }
Esempio n. 13
0
 @Test
 public void shouldReturnOutput() {
   assertThat(withOutput.getOutput(), is(new String[] {"some other text", "wooops"}));
 }