コード例 #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));
 }
コード例 #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>"));
 }
コード例 #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>"));
 }
コード例 #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>"));
 }
コード例 #5
0
 @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>"));
 }
コード例 #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);
   }
 }
コード例 #7
0
 @Test
 public void shouldReturnDataTableClass() {
   assertThat(passingStep.getDataTableClass(), is("passed"));
   assertThat(failingStep.getDataTableClass(), is("failed"));
 }
コード例 #8
0
 @Test
 public void shouldReturnDuration() {
   assertThat(passingStep.getDuration(), is(107447000L));
 }
コード例 #9
0
 @Test
 public void shouldReturnStatus() {
   assertThat(passingStep.getStatus(), is(Status.PASSED));
   assertThat(failingStep.getStatus(), is(Status.FAILED));
 }
コード例 #10
0
 @Test
 public void shouldReturnOutput() {
   assertThat(withOutput.getOutput(), is("<div>some other text</div><div>wooops</div>"));
 }
コード例 #11
0
 @Test
 public void shouldKnowIfHasRows() {
   assertThat(passingStep.hasRows(), is(false));
 }
コード例 #12
0
 @Test
 public void shouldNotCreateLinkToScreenshotWhenOneDoesNotExist() throws IOException {
   long screenshotTime = new DateTime().getMillis();
   DateTimeUtils.setCurrentMillisFixed(screenshotTime);
   assertThat(failingStep.getImageTags(), is(EMPTY));
 }
コード例 #13
0
ファイル: StepTest.java プロジェクト: bcub/cucumber-reporting
 @Test
 public void shouldReturnOutput() {
   assertThat(withOutput.getOutput(), is(new String[] {"some other text", "wooops"}));
 }