rspec_junit_formatter_jenkins 0.1.6
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 +7 -0
- data/LICENSE +20 -0
- data/README.md +46 -0
- data/lib/rspec/core/formatters/j_unit_formatter.rb +55 -0
- data/lib/rspec_junit_formatter.rb +8 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 07670f3813a151905b6e8e36970d3df3e8babcfa
|
4
|
+
data.tar.gz: 930dc3138e52178cacae4e2feaac4b3102f8967b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 464e40ecc66e66b61929e26e627248c13b5ea20331fa36a6be59d05824d09fdf7617322eea9e95c0b20602009635051260d424515d6797b7c45e29e8a6c5ae9f
|
7
|
+
data.tar.gz: 1c381b45084bc1178539d25b8893a87a9236689f7c14a6ec8f23e28426768d4a152b6f24e610703ca0f28d1bf7e993b1054175a2d70d42b1cb46edebe817ee75
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Samuel Cochran
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# RSpec JUnit Formatter
|
2
|
+
|
3
|
+
[RSpec][rspec] results that [Jenkins][jenkins] can read. Probably a few other CI servers, too.
|
4
|
+
|
5
|
+
Inspired by the work of [Diego Souza][dsouza] on [RSpec Formatters][dsouza/rspec_formatters] after frustration with [CI Reporter][ci_reporter].
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
Install the gem:
|
10
|
+
|
11
|
+
gem install rspec_junit_formatter
|
12
|
+
|
13
|
+
Use it:
|
14
|
+
|
15
|
+
rspec --format RspecJunitFormatter --out rspec.xml
|
16
|
+
|
17
|
+
You'll get an XML file with your results in it.
|
18
|
+
|
19
|
+
## More Permanent Usage
|
20
|
+
|
21
|
+
Add it to your Gemfile if you're using [Bundler][bundler]. Put it in the same groups as rspec.
|
22
|
+
|
23
|
+
In your .rspec, usually alongside another formatter, add:
|
24
|
+
|
25
|
+
--format RspecJunitFormatter
|
26
|
+
--out rspec.xml
|
27
|
+
|
28
|
+
I use it with the excellent [Fuubar formatter][fuubar].
|
29
|
+
|
30
|
+
## Roadmap
|
31
|
+
|
32
|
+
* It would be nice to split things up into individual test suites, although would this correspond to example groups? The subject? The spec file? Not sure yet.
|
33
|
+
* This would sit nicely in rspec-core, and has been designed to do so.
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
The MIT License, see [LICENSE][license].
|
38
|
+
|
39
|
+
[rspec]: http://rspec.info/
|
40
|
+
[jenkins]: http://jenkins-ci.org/
|
41
|
+
[dsouza]: https://github.com/dsouza
|
42
|
+
[dsouza/rspec_formatters]: https://github.com/dsouza/rspec_formatters
|
43
|
+
[ci_reporter]: http://caldersphere.rubyforge.org/ci_reporter/
|
44
|
+
[bundler]: http://gembundler.com/
|
45
|
+
[fuubar]: http://jeffkreeftmeijer.com/2010/fuubar-the-instafailing-rspec-progress-bar-formatter/
|
46
|
+
[license]: https://github.com/sj26/rspec-junit-formatter/blob/master/LICENSE
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'time'
|
2
|
+
|
3
|
+
# Dumps rspec results as a JUnit XML file.
|
4
|
+
# Based on XML schema: http://windyroad.org/dl/Open%20Source/JUnit.xsd
|
5
|
+
class RSpec::Core::Formatters::JUnitFormatter < RSpec::Core::Formatters::BaseFormatter
|
6
|
+
def xml
|
7
|
+
@xml ||= Builder::XmlMarkup.new :target => output, :indent => 2
|
8
|
+
end
|
9
|
+
|
10
|
+
def start example_count
|
11
|
+
@start = Time.now
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def dump_summary duration, example_count, failure_count, pending_count
|
16
|
+
super
|
17
|
+
|
18
|
+
xml.instruct!
|
19
|
+
xml.testsuite :tests => example_count, :failures => failure_count, :errors => 0, :time => '%.6f' % duration, :timestamp => @start.iso8601 do
|
20
|
+
xml.properties
|
21
|
+
examples.each do |example|
|
22
|
+
send :"dump_summary_example_#{example.execution_result[:status]}", example
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def xml_example example, &block
|
28
|
+
xml.testcase :classname => example_classname(example), :name => example.full_description, :time => '%.6f' % example.execution_result[:run_time], &block
|
29
|
+
end
|
30
|
+
|
31
|
+
def dump_summary_example_passed example
|
32
|
+
xml_example example
|
33
|
+
end
|
34
|
+
|
35
|
+
def dump_summary_example_pending example
|
36
|
+
xml_example example do
|
37
|
+
xml.skipped
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def dump_summary_example_failed example
|
42
|
+
exception = example.execution_result[:exception]
|
43
|
+
backtrace = format_backtrace exception.backtrace, example
|
44
|
+
|
45
|
+
xml_example example do
|
46
|
+
xml.error message: exception.to_s, type: exception.class.name do
|
47
|
+
xml.text! "#{exception.message.encode(:xml => :text)}\n#{backtrace.join.encode(:xml => :text)}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def example_classname example
|
53
|
+
example.file_path.sub(%r{\.[^/]*\Z}, "").gsub("/", ".").gsub(%r{\A\.+|\.+\Z}, "")
|
54
|
+
end
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec_junit_formatter_jenkins
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Touseef Liaqat
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-core
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "!="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.12.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "!="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.12.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: builder
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: RSpec results that Hudson can read. Code is forked from github.com/sj26/rspec_junit_formatter
|
56
|
+
and modified for our use.
|
57
|
+
email: touseefliaqat@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- lib/rspec/core/formatters/j_unit_formatter.rb
|
63
|
+
- lib/rspec_junit_formatter.rb
|
64
|
+
- README.md
|
65
|
+
- LICENSE
|
66
|
+
homepage: http://github.com/tliaqat/rspec_junit_formatter_jenkins
|
67
|
+
licenses: []
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.3.6
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.0.14
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: RSpec JUnit XML formatter modified for Jenkins
|
89
|
+
test_files: []
|