Skip to content

Commit

Permalink
trying to fix cucumber#61
Browse files Browse the repository at this point in the history
  • Loading branch information
yairgo authored and coffeencoke committed May 31, 2011
1 parent c17d667 commit bf7282f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
9 changes: 9 additions & 0 deletions fixtures/junit/features/scenario_outline.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Feature: Scenario outlines

Scenario Outline: Using scenario outlines
Given a <type> scenario

Examples:
| type |
| passing |
| failing |
31 changes: 30 additions & 1 deletion legacy_features/junit_formatter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,33 @@ can't convert .* into String \(TypeError\)
And STDERR should match
"""
You \*must\* specify \-\-out DIR for the junit formatter
"""
"""

Scenario: one feature, one scenario outline, two examples: one passing, one failing
When I run cucumber --format junit --out tmp/ features/scenario_outline.feature
Then it should fail with
"""
"""
And "fixtures/junit/tmp/TEST-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
Example row: | failing |
Message:
]]>
<![CDATA[ (RuntimeError)
features/scenario_outline.feature:4:in `Given a <type> scenario']]>
</failure>
</testcase>
</testsuite>
"""

4 changes: 4 additions & 0 deletions lib/cucumber/formatter/junit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def before_feature(feature)
@time = 0
end

def before_feature_element(feature_element)
@in_examples = feature_element.class == Ast::ScenarioOutline
end

def after_feature(feature)
@testsuite = OrderedXmlMarkup.new( :indent => 2 )
@testsuite.instruct!
Expand Down

0 comments on commit bf7282f

Please sign in to comment.