Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUnit formater doesn't report Scenario outline example with -x argument #124

Closed
floreal opened this issue Aug 22, 2011 · 11 comments
Closed

Comments

@floreal
Copy link

floreal commented Aug 22, 2011

Hello,
I noticed a little annoying bug. consider my Rakefile:

require 'rubygems'
require 'rake'
require 'cucumber/rake/task'

# some other tasks

namespace :cucumber do
  Cucumber::Rake::Task.new(:report) do |t|
    t.cucumber_opts = "-x -p #{browser} -f junit --out report -f pretty --no-color"
  end

  Cucumber::Rake::Task.new(:pretty) do |t|
    t.cucumber_opts = "-x -p #{browser}"
  end
end

The cucumber proffiles only define environment variable to set selenium url and desired browser capabilities

When i execure rake cucumber:report, only Scenarios are reported to the JUnit result report, Scenario Outlines examples aren't.
When I remove the -x flag they are reported.

@floreal
Copy link
Author

floreal commented Nov 16, 2011

I managed to see what happen actually: when -x argument is passed, whenever an error (even error on asseertions) occurs in a scennario outline case, the other cases of the outline wont execute (and will be considerated as failed)

@tobhahn
Copy link

tobhahn commented Nov 28, 2011

Here is a scenario to reproduce the error on today's master.

Steps to reproduce:

  • Save the following feature into legacy_features/junit_formatter_expand.feature:
Feature: JUnit output formatter
  In order for developers to create test reports with ant
  Cucumber should be able to output JUnit xml files

  Background:
    Given I am in junit
    And the tmp directory is empty


  Scenario: Expand scenario outline into one passing and one failing scenario
    When I run cucumber --format junit --expand --out tmp/ features/scenario_outline.feature
    Then it should fail with
      """

      """
    And "fixtures/junit/tmp/TEST-features-scenario_outline.xml" with junit duration "0.005" should contain
      """
      <?xml version="1.0" encoding="UTF-8"?>
      <testsuite errors="0" failures="1" name="Scenario outlines" skipped="0" tests="2" time="0.005">
      <testcase classname="Scenario outlines.Using scenario outlines" name="Using scenario outlines (outline example : | passing |)" time="0.005">
      </testcase>
      <testcase classname="Scenario outlines.Using scenario outlines" name="Using scenario outlines (outline example : | failing |)" time="0.005">
        <failure message="failed Using scenario outlines (outline example : | failing |)" type="failed">
          <![CDATA[Scenario Outline: Using scenario outlines

      Scenario: |failing|

      Given a failing scenario

      Message:
      ]]>
          <![CDATA[ (RuntimeError)
      features/scenario_outline.feature:4:in `Given a <type> scenario']]>
        </failure>
      </testcase>
      </testsuite>

      """
  • Run bin/cucumber legacy_features/junit_formatter_expand.feature.

Expected results:
No error.

Actual results:
The scenario fails with

Using the default profile...
......F

(::) failed steps (::)

expected: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<testsuite errors=\"0\" failures=\"1\" name=\"Scenario outlines\" skipped=\"0\" tests=\"2\" time=\"0.005\">\n<testcase classname=\"Scenario outlines.Using scenario outlines\" name=\"Using scenario outlines (outline example : | passing |)\" time=\"0.005\">\n</testcase>\n<testcase classname=\"Scenario outlines.Using scenario outlines\" name=\"Using scenario outlines (outline example : | failing |)\" time=\"0.005\">\n  <failure message=\"failed Using scenario outlines (outline example : | failing |)\" type=\"failed\">\n    <![CDATA[Scenario Outline: Using scenario outlines\n\nScenario: |failing|\n\nGiven a failing scenario\n\nMessage:\n]]>\n    <![CDATA[ (RuntimeError)\nfeatures/scenario_outline.feature:4:in `Given a <type> scenario']]>\n  </failure>\n</testcase>\n</testsuite>\n"
     got: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<testsuite errors=\"0\" failures=\"0\" name=\"Scenario outlines\" skipped=\"0\" tests=\"0\" time=\"0.005\">\n</testsuite>\n" (using ==)
Diff:
@@ -1,20 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<testsuite errors="0" failures="1" name="Scenario outlines" skipped="0" tests="2" time="0.005">
-<testcase classname="Scenario outlines.Using scenario outlines" name="Using scenario outlines (outline example : | passing |)" time="0.005">
-</testcase>
-<testcase classname="Scenario outlines.Using scenario outlines" name="Using scenario outlines (outline example : | failing |)" time="0.005">
-  <failure message="failed Using scenario outlines (outline example : | failing |)" type="failed">
-    <![CDATA[Scenario Outline: Using scenario outlines
-
-Scenario: |failing|
-
-Given a failing scenario
-
-Message:
-]]>
-    <![CDATA[ (RuntimeError)
-features/scenario_outline.feature:4:in `Given a <type> scenario']]>
-  </failure>
-</testcase>
+<testsuite errors="0" failures="0" name="Scenario outlines" skipped="0" tests="0" time="0.005">
 </testsuite>
 (RSpec::Expectations::ExpectationNotMetError)
./legacy_features/step_definitions/cucumber_steps.rb:110:in `/^"([^"]*)" with junit duration "([^"]*)" should contain$/'
legacy_features/junit_formatter_expand.feature:16:in `And "fixtures/junit/tmp/TEST-features-scenario_outline.xml" with junit duration "0.005" should contain'

Failing Scenarios:
cucumber legacy_features/junit_formatter_expand.feature:10 # Scenario: one feature, expand one scenario outline, two examples: one passing, one failing

1 scenario (1 failed)
5 steps (1 failed, 4 passed)

@shyam-prabhakar
Copy link

Any plans on fixing this, this seems like a fairly big issue for folks who want to use the 'expand' option with the junit formatter for scenario outlines.

@cjapes
Copy link

cjapes commented Jul 6, 2012

This is big issue for the people that are using cucumber with Jenkins, that depend on that junit output.
Any plans on fixing this?

@rtyler
Copy link
Contributor

rtyler commented Sep 4, 2012

This is affecting me as well, since I was probably one of the last people to touch the JUnit formatter, I'll look into fixing this up.

@mattwynne
Copy link
Member

@rtyler do you think you're still likely to fix this?

trcjr added a commit to trcjr/cucumber that referenced this issue Apr 8, 2013
@chrismdp chrismdp modified the milestone: 2.0 Mar 6, 2014
@mattwynne
Copy link
Member

Hands up if you still care about this issue.

@mattwynne
Copy link
Member

@brasmusson @richarda either of you fancy a crack at this one?

@richarda
Copy link
Contributor

Sure!
On Fri, Feb 13, 2015 at 5:48 PM Matt Wynne notifications@github.com wrote:

@brasmusson https://github.com/brasmusson @richarda
https://github.com/richarda either of you fancy a crack at this one?


Reply to this email directly or view it on GitHub
cucumber/common#124 (comment).

richarda added a commit to richarda/cucumber that referenced this issue Feb 14, 2015
richarda added a commit to richarda/cucumber that referenced this issue Feb 14, 2015
@tooky
Copy link
Member

tooky commented Mar 13, 2015

Closed in favour of #808

@tooky tooky closed this as completed Mar 13, 2015
marxarelli added a commit to marxarelli/cucumber that referenced this issue Jun 18, 2015
Jenkins chokes on JUnit XML results that contain no `testcase` elements,
a scenario that can arise due to issue cucumber#124. This expedient workaround
avoids writing out XML where no test results were actually handled.
marxarelli added a commit to marxarelli/cucumber that referenced this issue Jun 18, 2015
Jenkins chokes on JUnit XML results that contain no `testcase` elements,
a scenario that can arise due to issue cucumber#124. Backporting the fix to the
latter proved to be insanely difficult so I wrote this expedient
workaround that avoids writing out XML where no test results were
actually handled.
@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants