rspec_junit 3.0.4 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +1 -1
- data/README.md +21 -16
- data/features/basic.feature +2 -2
- data/features/individual_suites.feature +2 -2
- data/features/individual_tests.feature +5 -5
- data/features/suite_level_details.feature +6 -6
- data/lib/rspec_junit.rb +1 -1
- data/lib/rspec_junit/{junit.rb → rspec_junit.rb} +9 -5
- data/lib/rspec_junit/version.rb +2 -2
- data/spec/formatter_conformity_spec.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e43ef7ad781d8ba058f77fbced8755906da35d65
|
|
4
|
+
data.tar.gz: 03614b03d2423135aea6846c73e35d5d88adc733
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f82b82195be87fbc8bc7d437cadd9285a6b2f288526c0c5e33783bb12c73302b74bb7616fbbf0956b3ebd2009f3b69e2ca597d05867ef8c4146367789821d3e3
|
|
7
|
+
data.tar.gz: ecc2a0602bbbff9437d1e419cea03a1310e927bc4a9f4ff8bda4c277e52ef6792bd4dd4dc25069d6271a8baa55209c0dce7ef2f92390f44444dde4eccc28f105
|
data/.rspec
CHANGED
data/README.md
CHANGED
|
@@ -6,26 +6,31 @@
|
|
|
6
6
|
A fork of [yarjuf](https://github.com/natritmeyer/yarjuf) containing additional features and bug fixes.
|
|
7
7
|
Another popular junit formatter is [rspec_junit_formatter](https://github.com/sj26/rspec_junit_formatter).
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Changes from upstream:
|
|
9
|
+
## Usage
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Usage:
|
|
11
|
+
```ruby
|
|
12
|
+
# spec_helper.rb
|
|
13
|
+
require 'rspec_junit'
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
RSpec.configure do |config|
|
|
16
|
+
config.before(:suite) do
|
|
17
|
+
# Must register the formatter here and not in an options file. The options
|
|
18
|
+
# file uses the master process pid and globs all the xml files into one
|
|
19
|
+
# instead of the worker pids which output to individual files.
|
|
20
|
+
config.add_formatter RSpecJUnit, "junit_#{Process.pid}.xml"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
```
|
|
20
24
|
|
|
25
|
+
## Sauce Labs Jenkins notes
|
|
21
26
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
- If the values for `Job Name OS/Browser Pass/Fail Job Links` aren't autopopulated, ensure that
|
|
28
|
+
the Sauce username and API key have been provided to the Sauce Plugin. Under
|
|
29
|
+
**Sauce Labs Options** in the job configure menu check `Override default authentication`
|
|
30
|
+
and then provide the user and access key.
|
|
31
|
+
- If the JUnit results report doesn't auto link to Sauce Labs jobs, ensure that
|
|
32
|
+
the **Post-build Actions** lists **Publish JUnit test results report** as the first action
|
|
33
|
+
and that **Run Sauce Labs Test Publisher** is after the JUnit action.
|
|
29
34
|
|
|
30
35
|
--
|
|
31
36
|
|
data/features/basic.feature
CHANGED
|
@@ -14,11 +14,11 @@ Feature: Basic use of Yarjuf
|
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
16
|
Scenario: Requiring Yarjuf
|
|
17
|
-
When I run `rspec spec/basic_spec.rb -r ../../lib/rspec_junit -f
|
|
17
|
+
When I run `rspec spec/basic_spec.rb -r ../../lib/rspec_junit -f RSpecJUnit`
|
|
18
18
|
Then the exit status should be 0
|
|
19
19
|
|
|
20
20
|
Scenario: Writing output to a file
|
|
21
|
-
When I run `rspec spec/basic_spec.rb -r ../../lib/rspec_junit -f
|
|
21
|
+
When I run `rspec spec/basic_spec.rb -r ../../lib/rspec_junit -f RSpecJUnit -o results.xml`
|
|
22
22
|
Then the exit status should be 0
|
|
23
23
|
And a file named "results.xml" should exist
|
|
24
24
|
|
|
@@ -20,7 +20,7 @@ Feature: Individual suites
|
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
"""
|
|
23
|
-
When I run `rspec spec/suite_one_spec.rb spec/suite_two_spec.rb -r ../../lib/rspec_junit -f
|
|
23
|
+
When I run `rspec spec/suite_one_spec.rb spec/suite_two_spec.rb -r ../../lib/rspec_junit -f RSpecJUnit -o results.xml`
|
|
24
24
|
Then the junit output file contains two testsuite elements named 'suite one' and 'suite two'
|
|
25
25
|
And the junit output file has one test against each suite
|
|
26
26
|
|
|
@@ -76,7 +76,7 @@ Feature: Individual suites
|
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
"""
|
|
79
|
-
When I run `rspec spec/suite_one_spec.rb spec/suite_two_spec.rb -r ../../lib/rspec_junit -f
|
|
79
|
+
When I run `rspec spec/suite_one_spec.rb spec/suite_two_spec.rb -r ../../lib/rspec_junit -f RSpecJUnit -o results.xml`
|
|
80
80
|
Then the junit output file contains two testsuite elements named 'suite one' and 'suite two'
|
|
81
81
|
And the junit output file has the correct test counts against each suite
|
|
82
82
|
|
|
@@ -12,7 +12,7 @@ Feature: Individual Tests
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
"""
|
|
15
|
-
When I run `rspec spec/simple_test_name_spec.rb -r ../../lib/rspec_junit -f
|
|
15
|
+
When I run `rspec spec/simple_test_name_spec.rb -r ../../lib/rspec_junit -f RSpecJUnit -o results.xml`
|
|
16
16
|
Then the junit output file contains a test result with a simple name
|
|
17
17
|
|
|
18
18
|
Scenario: Nested tests
|
|
@@ -32,7 +32,7 @@ Feature: Individual Tests
|
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
"""
|
|
35
|
-
When I run `rspec spec/nested_spec.rb -r ../../lib/rspec_junit -f
|
|
35
|
+
When I run `rspec spec/nested_spec.rb -r ../../lib/rspec_junit -f RSpecJUnit -o results.xml`
|
|
36
36
|
Then the junit output file has a nicely rendered nested test name
|
|
37
37
|
|
|
38
38
|
Scenario: Test duration
|
|
@@ -44,7 +44,7 @@ Feature: Individual Tests
|
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
"""
|
|
47
|
-
When I run `rspec spec/test_duration_spec.rb -r ../../lib/rspec_junit -f
|
|
47
|
+
When I run `rspec spec/test_duration_spec.rb -r ../../lib/rspec_junit -f RSpecJUnit -o results.xml`
|
|
48
48
|
Then the junit output file contains a test with a duration
|
|
49
49
|
|
|
50
50
|
Scenario: Pending test
|
|
@@ -57,7 +57,7 @@ Feature: Individual Tests
|
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
"""
|
|
60
|
-
When I run `rspec spec/pending_test_spec.rb -r ../../lib/rspec_junit -f
|
|
60
|
+
When I run `rspec spec/pending_test_spec.rb -r ../../lib/rspec_junit -f RSpecJUnit -o results.xml`
|
|
61
61
|
Then the junit output file contains a pending test
|
|
62
62
|
|
|
63
63
|
Scenario: Failing test
|
|
@@ -69,6 +69,6 @@ Feature: Individual Tests
|
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
"""
|
|
72
|
-
When I run `rspec spec/failing_test_spec.rb -r ../../lib/rspec_junit -f
|
|
72
|
+
When I run `rspec spec/failing_test_spec.rb -r ../../lib/rspec_junit -f RSpecJUnit -o results.xml`
|
|
73
73
|
Then the junit output file contains a failing test
|
|
74
74
|
|
|
@@ -12,7 +12,7 @@ Feature: Suite Summary
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
"""
|
|
15
|
-
When I run `rspec spec/suite_element_spec.rb -r ../../lib/rspec_junit -f
|
|
15
|
+
When I run `rspec spec/suite_element_spec.rb -r ../../lib/rspec_junit -f RSpecJUnit -o results.xml`
|
|
16
16
|
Then the junit output contains the testsuite element
|
|
17
17
|
|
|
18
18
|
Scenario: One passing test
|
|
@@ -24,7 +24,7 @@ Feature: Suite Summary
|
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
"""
|
|
27
|
-
When I run `rspec spec/one_passing_test_spec.rb -r ../../lib/rspec_junit -f
|
|
27
|
+
When I run `rspec spec/one_passing_test_spec.rb -r ../../lib/rspec_junit -f RSpecJUnit -o results.xml`
|
|
28
28
|
Then the junit output reports one passing test
|
|
29
29
|
|
|
30
30
|
Scenario: One failing test
|
|
@@ -36,7 +36,7 @@ Feature: Suite Summary
|
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
"""
|
|
39
|
-
When I run `rspec spec/one_failing_test_spec.rb -r ../../lib/rspec_junit -f
|
|
39
|
+
When I run `rspec spec/one_failing_test_spec.rb -r ../../lib/rspec_junit -f RSpecJUnit -o results.xml`
|
|
40
40
|
Then the junit output reports one failing test
|
|
41
41
|
|
|
42
42
|
Scenario: One pending test
|
|
@@ -49,7 +49,7 @@ Feature: Suite Summary
|
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
"""
|
|
52
|
-
When I run `rspec spec/one_pending_test_spec.rb -r ../../lib/rspec_junit -f
|
|
52
|
+
When I run `rspec spec/one_pending_test_spec.rb -r ../../lib/rspec_junit -f RSpecJUnit -o results.xml`
|
|
53
53
|
Then the junit output reports one pending test
|
|
54
54
|
|
|
55
55
|
Scenario: Test suite duration
|
|
@@ -61,7 +61,7 @@ Feature: Suite Summary
|
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
"""
|
|
64
|
-
When I run `rspec spec/suite_duration_spec.rb -r ../../lib/rspec_junit -f
|
|
64
|
+
When I run `rspec spec/suite_duration_spec.rb -r ../../lib/rspec_junit -f RSpecJUnit -o results.xml`
|
|
65
65
|
Then the junit output testsuite element contains a duration
|
|
66
66
|
|
|
67
67
|
Scenario: Test suite time stamp
|
|
@@ -73,6 +73,6 @@ Feature: Suite Summary
|
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
"""
|
|
76
|
-
When I run `rspec spec/suite_timestamp_spec.rb -r ../../lib/rspec_junit -f
|
|
76
|
+
When I run `rspec spec/suite_timestamp_spec.rb -r ../../lib/rspec_junit -f RSpecJUnit -o results.xml`
|
|
77
77
|
Then the junit output testsuite element contains a timestamp
|
|
78
78
|
|
data/lib/rspec_junit.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# RSpec formatter for generating results in JUnit format
|
|
2
2
|
# Inherit from BaseFormatter like the JSON rspec-core formatter.
|
|
3
|
-
class
|
|
3
|
+
class RSpecJUnit < RSpec::Core::Formatters::BaseFormatter
|
|
4
4
|
RSpec::Core::Formatters.register self, :example_passed, :example_failed,
|
|
5
5
|
:example_pending, :dump_summary,
|
|
6
6
|
:close
|
|
@@ -42,7 +42,7 @@ class JUnit < RSpec::Core::Formatters::BaseFormatter
|
|
|
42
42
|
protected
|
|
43
43
|
|
|
44
44
|
def add_to_test_suite_results(example_notification)
|
|
45
|
-
suite_name =
|
|
45
|
+
suite_name = RSpecJUnit.root_group_name_for example_notification
|
|
46
46
|
@test_suite_results[suite_name] = [] unless @test_suite_results.keys.include? suite_name
|
|
47
47
|
@test_suite_results[suite_name] << example_notification.example
|
|
48
48
|
end
|
|
@@ -55,7 +55,11 @@ class JUnit < RSpec::Core::Formatters::BaseFormatter
|
|
|
55
55
|
backtrace = RSpec::Core::BacktraceFormatter.new.format_backtrace exception.backtrace
|
|
56
56
|
backtrace = "\n#{backtrace.join("\n")}"
|
|
57
57
|
end
|
|
58
|
-
|
|
58
|
+
sauce_test_link = example.metadata[:sauce_test_link]
|
|
59
|
+
|
|
60
|
+
result = "\n#{exception.class.name}\n#{exception.message}#{backtrace}"
|
|
61
|
+
result += "\n\n#{sauce_test_link}" if sauce_test_link
|
|
62
|
+
result
|
|
59
63
|
end
|
|
60
64
|
|
|
61
65
|
# utility methods
|
|
@@ -90,8 +94,8 @@ class JUnit < RSpec::Core::Formatters::BaseFormatter
|
|
|
90
94
|
end
|
|
91
95
|
|
|
92
96
|
def build_test_suite(suite_name, tests)
|
|
93
|
-
failure_count =
|
|
94
|
-
skipped_count =
|
|
97
|
+
failure_count = RSpecJUnit.count_in_suite_of_type(tests, :failed)
|
|
98
|
+
skipped_count = RSpecJUnit.count_in_suite_of_type(tests, :pending)
|
|
95
99
|
|
|
96
100
|
@builder.testsuite(
|
|
97
101
|
location: tests.first.example_group.location,
|
data/lib/rspec_junit/version.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
require_relative 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe RSpecJUnit do
|
|
4
4
|
context 'interface conformity' do
|
|
5
5
|
|
|
6
|
-
subject {
|
|
6
|
+
subject { RSpecJUnit.new 'some output' }
|
|
7
7
|
|
|
8
8
|
it 'should respond to example passed' do
|
|
9
9
|
should respond_to :example_passed
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec_junit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nat Ritmeyer
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2015-10-
|
|
12
|
+
date: 2015-10-16 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rspec
|
|
@@ -221,8 +221,8 @@ files:
|
|
|
221
221
|
- features/suite_level_details.feature
|
|
222
222
|
- features/support/env.rb
|
|
223
223
|
- lib/rspec_junit.rb
|
|
224
|
-
- lib/rspec_junit/junit.rb
|
|
225
224
|
- lib/rspec_junit/merged_xml.rb
|
|
225
|
+
- lib/rspec_junit/rspec_junit.rb
|
|
226
226
|
- lib/rspec_junit/version.rb
|
|
227
227
|
- rspec_junit.gemspec
|
|
228
228
|
- spec/fake_foreach_patch.rb
|