danger-junit 0.6.1 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +39 -8
- data/img/example.png +0 -0
- data/lib/junit/gem_version.rb +1 -1
- data/lib/junit/plugin.rb +3 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92d9f76ebd894f63da916daf4ef076078a804160
|
4
|
+
data.tar.gz: 831035a9f746308120c1e0d41041c269d762938f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2351b57746568cc787ec8a55f4fa783103dbfcefc37e79287ec410b03081ef5abbc46ae989d00c6990c5fc381fb89a16016a45185209731ee982cbf41c55feb1
|
7
|
+
data.tar.gz: ca1923bea3424849bd2a1328f94752c990621151fb8eeaa2152039eadf3e77f1c2272cef3558ac38cf86ebf562568c234a7848805b9dc4bb340a4dc5dcd7ac1a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# danger-junit
|
2
2
|
|
3
|
-
|
3
|
+
This Danger Plugin allows you to standardise the output for all of your testing runs. Most test runners include an ability to have a reporter that conforms to the JUnit XML standard. This plugin will understand that file and offer a way to introspect it, and to report on it.
|
4
|
+
|
5
|
+
![](img/example.png)
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -8,7 +10,36 @@ A description of danger-junit.
|
|
8
10
|
|
9
11
|
## Usage
|
10
12
|
|
13
|
+
### Ruby
|
14
|
+
|
15
|
+
For Rspec, add the gem `rspec_junit_formatter` to your project. Then use a `.rspec` file to configure your tests to have multiple reporters. This file looks like:
|
16
|
+
|
17
|
+
``` sh
|
18
|
+
...
|
19
|
+
--format documentation
|
20
|
+
--format RspecJunitFormatter --out junit-results.xml
|
21
|
+
...
|
22
|
+
```
|
23
|
+
|
24
|
+
Then you can pass the `junit-results.xml` file to the plugin in your `Dangerfile`.
|
25
|
+
|
26
|
+
### JS
|
27
|
+
|
28
|
+
In a Jasmine, or Jest testing project, you want to install the module `jasmine-reporters`. Then as you are setting up your Jasmine runner, [add the following](https://github.com/larrymyers/jasmine-reporters#basic-usage):
|
29
|
+
|
30
|
+
```
|
31
|
+
var junitReporter = new jasmineReporters.JUnitXmlReporter({
|
32
|
+
savePath: 'junit-results.xml',
|
33
|
+
consolidateAll: false
|
34
|
+
});
|
35
|
+
jasmine.getEnv().addReporter(junitReporter);
|
36
|
+
```
|
37
|
+
|
38
|
+
Then you can pass the `junit-results.xml` file to the plugin in your `Dangerfile`.
|
11
39
|
|
40
|
+
### iOS
|
41
|
+
|
42
|
+
Both [xcpretty](https://github.com/supermarin/xcpretty#reporters) and [XCTool](https://github.com/facebook/xctool#included-reporters) include reporters for creating a JUnit XML file. As Fastlane's [scan](https://github.com/fastlane/fastlane/tree/master/scan) uses xcpretty, it also has support for the file.
|
12
43
|
|
13
44
|
### junit
|
14
45
|
|
@@ -58,19 +89,19 @@ message "#{slowest_test[:time]} took #{slowest_test[:time]} seconds"</pre>
|
|
58
89
|
|
59
90
|
|
60
91
|
#### Attributes
|
61
|
-
|
92
|
+
|
62
93
|
`tests` - All the tests for introspection
|
63
|
-
|
94
|
+
|
64
95
|
`passes` - An array of XML elements that represent passed tests.
|
65
|
-
|
96
|
+
|
66
97
|
`failures` - An array of XML elements that represent failed tests.
|
67
|
-
|
98
|
+
|
68
99
|
`errors` - An array of XML elements that represent passed tests.
|
69
|
-
|
100
|
+
|
70
101
|
`skipped` - An array of XML elements that represent skipped tests.
|
71
|
-
|
102
|
+
|
72
103
|
`show_skipped_tests` - An attribute to make the plugin show a warning on skipped tests.
|
73
|
-
|
104
|
+
|
74
105
|
`headers` - An array of symbols that become the columns of your tests,
|
75
106
|
if `nil`, the default, it will be all of the attribues.
|
76
107
|
|
data/img/example.png
ADDED
Binary file
|
data/lib/junit/gem_version.rb
CHANGED
data/lib/junit/plugin.rb
CHANGED
@@ -6,7 +6,8 @@ module Danger
|
|
6
6
|
# XCTest and more - can all use the same Danger error reporting. Perfect.
|
7
7
|
#
|
8
8
|
# You can see some examples on [this page from Circle CI](https://circleci.com/docs/test-metadata/)
|
9
|
-
#
|
9
|
+
# and on this [project's README](https://github.com/orta/danger-junit.git) about how you
|
10
|
+
# can add JUnit XML output for your testing projects.
|
10
11
|
#
|
11
12
|
# @example Parse the XML file, and let the plugin do your reporting
|
12
13
|
#
|
@@ -96,9 +97,7 @@ module Danger
|
|
96
97
|
failed_tests = failed_suites.map(&:nodes).flatten.select { |node| node.value == 'testcase' }
|
97
98
|
|
98
99
|
@failures = failed_tests.select { |test| test.nodes.count > 0 }.select { |test| test.nodes.first.value == 'failure' }
|
99
|
-
|
100
100
|
@errors = failed_tests.select { |test| test.nodes.count > 0 }.select { |test| test.nodes.first.value == 'error' }
|
101
|
-
|
102
101
|
@skipped = tests.select { |test| test.nodes.count > 0 }.select { |test| test.nodes.first.value == 'skipped' }
|
103
102
|
|
104
103
|
@passes = tests - @failures - @errors - @skipped
|
@@ -137,7 +136,7 @@ module Danger
|
|
137
136
|
|
138
137
|
def auto_link(value)
|
139
138
|
if File.exist?(value) && defined?(@dangerfile.github)
|
140
|
-
github.html_link
|
139
|
+
github.html_link(value, full_path: false)
|
141
140
|
else
|
142
141
|
value
|
143
142
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-junit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Orta Therox
|
@@ -194,6 +194,7 @@ files:
|
|
194
194
|
- README.md
|
195
195
|
- Rakefile
|
196
196
|
- danger-junit.gemspec
|
197
|
+
- img/example.png
|
197
198
|
- lib/danger_junit.rb
|
198
199
|
- lib/danger_plugin.rb
|
199
200
|
- lib/junit/gem_version.rb
|
@@ -223,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
224
|
version: '0'
|
224
225
|
requirements: []
|
225
226
|
rubyforge_project:
|
226
|
-
rubygems_version: 2.
|
227
|
+
rubygems_version: 2.2.2
|
227
228
|
signing_key:
|
228
229
|
specification_version: 4
|
229
230
|
summary: Get automatic inline test reporting for JUnit-conforming XML files
|