Skip to content

Commit

Permalink
Fix junit formatter problems on Windows. Closes #81. Closes #86.
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Jul 10, 2011
1 parent f3a6bd5 commit 7f6030b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
1 change: 1 addition & 0 deletions History.md
Expand Up @@ -3,6 +3,7 @@
### Bugfixes
* Removed extra colons emitted by rerun formatter ([#99](https://github.com/cucumber/cucumber/pull/99) Juan Manuel Barreneche)
* cucumber 1.0.0 wrong number of arguments error when generating json format on jruby for windows ([#97](https://github.com/cucumber/cucumber/issues/97) (Aslak Hellesøy)
* Recent change to junit.rb breaks on Windows ([#81](https://github.com/cucumber/cucumber/issues/81), [#86](https://github.com/cucumber/cucumber/pull/86) Johnlon, Aslak Hellesøy)

### New Features
* If the CUCUMBER_TRUNCATE_OUTPUT environment variable is set, lines will be truncated. Used by the Cucumber book. (Aslak Hellesøy)
Expand Down
14 changes: 7 additions & 7 deletions legacy_features/junit_formatter.feature
Expand Up @@ -12,7 +12,7 @@ Feature: JUnit output formatter
"""
"""
And "fixtures/junit/tmp/TEST-one_passing_one_failing.xml" with junit duration "0.005" should contain
And "fixtures/junit/tmp/TEST-features-one_passing_one_failing.xml" with junit duration "0.005" should contain
"""
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="1" name="One passing scenario, one failing scenario" skipped="0" tests="2" time="0.005">
Expand Down Expand Up @@ -40,7 +40,7 @@ Feature: JUnit output formatter
"""
"""
And "fixtures/junit/tmp/TEST-some_subdirectory_one_passing_one_failing.xml" with junit duration "0.005" should contain
And "fixtures/junit/tmp/TEST-features-some_subdirectory-one_passing_one_failing.xml" with junit duration "0.005" should contain
"""
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="1" name="Subdirectory - One passing scenario, one failing scenario" skipped="0" tests="2" time="0.005">
Expand Down Expand Up @@ -68,7 +68,7 @@ Feature: JUnit output formatter
"""
"""
And "fixtures/junit/tmp/TEST-pending.xml" with junit duration "0.009" should contain
And "fixtures/junit/tmp/TEST-features-pending.xml" with junit duration "0.009" should contain
"""
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="0" name="Pending step" skipped="2" tests="2" time="0.009">
Expand All @@ -88,7 +88,7 @@ Feature: JUnit output formatter
"""
"""
And "fixtures/junit/tmp/TEST-pending.xml" with junit duration "0.000160" should contain
And "fixtures/junit/tmp/TEST-features-pending.xml" with junit duration "0.000160" should contain
"""
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="2" name="Pending step" skipped="0" tests="2" time="0.000160">
Expand Down Expand Up @@ -120,8 +120,8 @@ Feature: JUnit output formatter
"""
"""
And "fixtures/junit/tmp/TEST-one_passing_one_failing.xml" should exist
And "fixtures/junit/tmp/TEST-pending.xml" should exist
And "fixtures/junit/tmp/TEST-features-one_passing_one_failing.xml" should exist
And "fixtures/junit/tmp/TEST-features-pending.xml" should exist

Scenario: show correct error message if no --out is passed
When I run cucumber --format junit features
Expand All @@ -140,7 +140,7 @@ You \*must\* specify \-\-out DIR for the junit formatter
"""
"""
And "fixtures/junit/tmp/TEST-scenario_outline.xml" with junit duration "0.005" should contain
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">
Expand Down
3 changes: 1 addition & 2 deletions lib/cucumber/formatter/junit.rb
Expand Up @@ -144,8 +144,7 @@ def feature_result_filename(feature_file)
end

def basename(feature_file)
ext_length = File.extname(feature_file).length
feature_file.gsub('features/', '').gsub(File::SEPARATOR, '_')[0...-ext_length]
File.basename(feature_file.gsub(/[\\\/]/, '-'), '.feature')
end

def write_file(feature_filename, data)
Expand Down
2 changes: 1 addition & 1 deletion spec/cucumber/formatter/junit_spec.rb
Expand Up @@ -61,7 +61,7 @@ def write_file(feature_filename, data)
}, File.join('features', 'some', 'path', 'spec.feature')

it 'writes the filename including the subdirectory' do
@formatter.written_files.keys.first.should == File.join('', 'TEST-some_path_spec.xml')
@formatter.written_files.keys.first.should == File.join('', 'TEST-features-some-path-spec.xml')
end
end

Expand Down

0 comments on commit 7f6030b

Please sign in to comment.