rspec_flake 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rspec +1 -0
- data/.travis.yml +4 -0
- data/Gemfile +2 -0
- data/LICENSE-2.0.txt +202 -0
- data/Thorfile +5 -0
- data/bin/rspec_flake +32 -0
- data/lib/rspec_flake.rb +16 -0
- data/lib/rspec_flake/convert.rb +42 -0
- data/lib/rspec_flake/merge.rb +53 -0
- data/lib/rspec_flake/parse.rb +82 -0
- data/lib/rspec_flake/rspec_flake.rb +34 -0
- data/lib/rspec_flake/stats.rb +27 -0
- data/lib/rspec_flake/version.rb +4 -0
- data/readme.md +29 -0
- data/rspec_flake.gemspec +32 -0
- data/spec/convert_spec.rb +15 -0
- data/spec/data/0.xml +20 -0
- data/spec/data/1.xml +20 -0
- data/spec/data/2.xml +20 -0
- data/spec/data/failure.xml +19 -0
- data/spec/data/failure2.xml +19 -0
- data/spec/merge_spec.rb +9 -0
- data/spec/parse_spec.rb +15 -0
- data/spec/spec_helper.rb +220 -0
- data/spec/stats_spec.rb +8 -0
- metadata +212 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ddf8b23820f9a9c70134347ce5783b997c8f9479
|
4
|
+
data.tar.gz: 9105e73aff6d96d06ca8aebf93f1ae558431545e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bd723da8db453f24b5b6e0f700fe54b777cdad0d484a1a37aa8443491063549d150b1560a575f2c000940c463a1537e1886c1ca90af4582a60106b0cf9a70df4
|
7
|
+
data.tar.gz: c540999f95f0a591673d6e8b20cc4b2d529941b76c7b99b87fc9bd00292fbc55e95b962905dfdca5b648f9d3fc59668355c600ecc799141e99fbe3d9c3c7295b
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE-2.0.txt
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
data/Thorfile
ADDED
data/bin/rspec_flake
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
require File.expand_path '../../lib/rspec_flake', __FILE__
|
4
|
+
|
5
|
+
module RSpecFlake
|
6
|
+
class << self
|
7
|
+
def run_rspec_flake
|
8
|
+
usage_string = <<-'MSG'
|
9
|
+
rspec_flake [count] [rspec command]
|
10
|
+
|
11
|
+
rspec_flake 1 rspec
|
12
|
+
Run tests once
|
13
|
+
|
14
|
+
rspec_flake 2 rspec -e "some test"
|
15
|
+
Run some test twice
|
16
|
+
MSG
|
17
|
+
|
18
|
+
args = ARGV
|
19
|
+
|
20
|
+
if args && args.length >= 2 && args.first.match(/\d+/)
|
21
|
+
command = args.join(' ')[1..-1].strip
|
22
|
+
RSpecFlake::Runner.run_tests count: args.first, command: command
|
23
|
+
exit
|
24
|
+
else
|
25
|
+
puts usage_string
|
26
|
+
exit
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
RSpecFlake.run_rspec_flake
|
data/lib/rspec_flake.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rubygems' # gem requires
|
3
|
+
require 'nokogiri'
|
4
|
+
require 'xmlsimple'
|
5
|
+
require 'posix/spawn' # http://rubygems.org/gems/posix-spawn
|
6
|
+
require 'escape_utils'
|
7
|
+
|
8
|
+
# ruby requies
|
9
|
+
require 'fileutils'
|
10
|
+
|
11
|
+
require_relative 'rspec_flake/rspec_flake'
|
12
|
+
require_relative 'rspec_flake/version'
|
13
|
+
require_relative 'rspec_flake/convert'
|
14
|
+
require_relative 'rspec_flake/parse'
|
15
|
+
require_relative 'rspec_flake/merge'
|
16
|
+
require_relative 'rspec_flake/stats'
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module RSpecFlake
|
2
|
+
class << self
|
3
|
+
def hash_to_xml source_hash
|
4
|
+
# top level attribues from root node
|
5
|
+
converted = source_hash[:testsuites][:attrs] || {}
|
6
|
+
converted[:testsuite] = []
|
7
|
+
|
8
|
+
source_hash[:testsuites][:testsuite].each do |suite_location, suite_obj|
|
9
|
+
suite_with_tests = suite_obj[:attrs] || {}
|
10
|
+
suite_with_tests[:testcase] = []
|
11
|
+
suite_obj[:testcase].each do |testcase_location, testcase_obj|
|
12
|
+
testcase = testcase_obj[:attrs]
|
13
|
+
if testcase_obj[:failure]
|
14
|
+
fail_content = testcase_obj[:failure][:content]
|
15
|
+
fail_content = cdata fail_content
|
16
|
+
# content key must be a string for xml simple
|
17
|
+
testcase.merge!(failure: testcase_obj[:failure][:attrs].merge('content' => fail_content))
|
18
|
+
end
|
19
|
+
suite_with_tests[:testcase] << testcase
|
20
|
+
end
|
21
|
+
|
22
|
+
converted[:testsuite] << suite_with_tests
|
23
|
+
end
|
24
|
+
|
25
|
+
# ap converted, index: false, indent: 2
|
26
|
+
|
27
|
+
xml_out converted
|
28
|
+
end
|
29
|
+
|
30
|
+
def cdata content
|
31
|
+
"\n<![CDATA[#{content}]]>\n"
|
32
|
+
end
|
33
|
+
|
34
|
+
def xml_out hash
|
35
|
+
xml_header = %Q(<?xml version="1.0" encoding="UTF-8"?>\n)
|
36
|
+
xml_body = XmlSimple.xml_out(hash, RootName: 'testsuites')
|
37
|
+
# xmlsimple will escape the cdata by default
|
38
|
+
xml_body = EscapeUtils.unescape_html xml_body
|
39
|
+
xml_header + xml_body
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module RSpecFlake
|
2
|
+
class << self
|
3
|
+
|
4
|
+
# merge input xml files into a hash
|
5
|
+
#
|
6
|
+
# input - single path or array of paths to input xml files
|
7
|
+
# @return merged hash
|
8
|
+
def merge_xml opts={}
|
9
|
+
input = opts[:input]
|
10
|
+
raise 'input path(s) not provided' unless input
|
11
|
+
input = [input] unless input.kind_of?(Array)
|
12
|
+
|
13
|
+
merged = { testsuite: { testcase: {} } }
|
14
|
+
|
15
|
+
# annotate each testcase node with two attributes
|
16
|
+
#
|
17
|
+
# failures - amount of times this test failed
|
18
|
+
# runs - amount of times this test was executed
|
19
|
+
#
|
20
|
+
# name/time - saved from the first run of the testcase
|
21
|
+
# location - stored for each run
|
22
|
+
|
23
|
+
input.each do |xml_path|
|
24
|
+
parsed = parse_xml(xml_path)
|
25
|
+
|
26
|
+
parsed[:testsuites][:testsuite].each do |suite_location, suite_obj|
|
27
|
+
suite_obj[:testcase].each do |testcase_location, testcase_obj|
|
28
|
+
attrs = testcase_obj[:attrs]
|
29
|
+
test = merged[:testsuite][:testcase][testcase_location] ||= { failures: 0, runs: 0, name: attrs['name'], location: attrs['location'], time: [] }
|
30
|
+
|
31
|
+
if testcase_obj[:failure]
|
32
|
+
test[:failures] += 1
|
33
|
+
test[:failure] ||= []
|
34
|
+
test[:failure] << { 'content' => cdata(testcase_obj[:failure][:content]) }
|
35
|
+
end
|
36
|
+
test[:runs] += 1
|
37
|
+
test[:time] << attrs['time']
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# transform merge hash keyed on location into simple testcase array
|
43
|
+
# for xml conversion
|
44
|
+
converted = { testsuite: { testcase: [] } }
|
45
|
+
|
46
|
+
merged[:testsuite][:testcase].each do |testcase_location, testcase_obj|
|
47
|
+
converted[:testsuite][:testcase] << testcase_obj
|
48
|
+
end
|
49
|
+
|
50
|
+
xml_out converted
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
=begin
|
2
|
+
<testsuite errors="0" failures="0" skipped="0" tests="4" time="0.001283" timestamp="2015-01-15T10:25:40-05:00">
|
3
|
+
<testsuite location="./spec/a_spec.rb:1" name="a" tests="2" errors="0" failures="0" skipped="0">
|
4
|
+
<testcase name="a a 1" time="0.000177" location="./spec/a_spec.rb:6">
|
5
|
+
|
6
|
+
# sax parser
|
7
|
+
# http://nokogiri.org/Nokogiri/XML/SAX.html
|
8
|
+
=end
|
9
|
+
|
10
|
+
module RSpecFlake
|
11
|
+
class << self
|
12
|
+
class ReportParser < Nokogiri::XML::SAX::Document
|
13
|
+
def initialize
|
14
|
+
reset
|
15
|
+
end
|
16
|
+
|
17
|
+
def reset
|
18
|
+
@data = {}
|
19
|
+
@suite_location = nil
|
20
|
+
@testcase_location = nil
|
21
|
+
@failure = nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def result
|
25
|
+
@data
|
26
|
+
end
|
27
|
+
|
28
|
+
def start_element name, attrs = []
|
29
|
+
name = name.to_sym
|
30
|
+
attrs = attrs.to_h
|
31
|
+
testsuite = :testsuite
|
32
|
+
root = :testsuites
|
33
|
+
location = attrs['location']
|
34
|
+
|
35
|
+
case name
|
36
|
+
when root
|
37
|
+
@data[root] ||= { attrs: attrs, testsuite: {} }
|
38
|
+
when :testsuite
|
39
|
+
@suite_location = location
|
40
|
+
@data[root][testsuite][@suite_location] ||= { attrs: attrs, testcase: {} }
|
41
|
+
when :testcase
|
42
|
+
raise 'testcase not part of a suite' unless @suite_location
|
43
|
+
@testcase_location = location
|
44
|
+
@data[root][testsuite][@suite_location][:testcase][location] ||= { attrs: attrs }
|
45
|
+
when :failure
|
46
|
+
raise 'failure not part of a testcase' unless @testcase_location
|
47
|
+
@data[root][testsuite][@suite_location][:testcase][@testcase_location].merge!({ failure: { attrs: attrs } })
|
48
|
+
@failure = @data[root][testsuite][@suite_location][:testcase][@testcase_location][:failure]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def cdata_block string
|
53
|
+
raise 'cdata not associated with failure' unless @failure
|
54
|
+
@failure[:content] = string
|
55
|
+
@failure = nil
|
56
|
+
end
|
57
|
+
|
58
|
+
def end_element name
|
59
|
+
case name
|
60
|
+
when 'testsuite'
|
61
|
+
@suite_location = nil
|
62
|
+
when 'testcase'
|
63
|
+
@testcase_location = nil
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def read_as_utf8 path
|
69
|
+
File.read(path).encode!('UTF-8', invalid: :replace, undef: :replace, replace: '')
|
70
|
+
end
|
71
|
+
|
72
|
+
def parse_xml xml_path
|
73
|
+
xml = read_as_utf8 xml_path
|
74
|
+
|
75
|
+
parser = @parser ||= Nokogiri::XML::SAX::Parser.new(ReportParser.new)
|
76
|
+
parser.document.reset
|
77
|
+
parser.parse xml
|
78
|
+
|
79
|
+
parser.document.result
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module RSpecFlake
|
3
|
+
class Runner
|
4
|
+
def self.run_tests opts={}
|
5
|
+
count = opts[:count]
|
6
|
+
raise 'count is required and must be a number' unless count && count.match(/\d+/)
|
7
|
+
count = count.to_i
|
8
|
+
|
9
|
+
command = opts[:command]
|
10
|
+
raise "command is required and must start with rspec. #{command}" unless command && command.start_with?('rspec')
|
11
|
+
|
12
|
+
tmp_path = File.expand_path File.join Dir.pwd, 'tmp'
|
13
|
+
FileUtils.rm_rf tmp_path
|
14
|
+
FileUtils.mkdir_p tmp_path
|
15
|
+
|
16
|
+
xml_files = []
|
17
|
+
|
18
|
+
count.times do |iteration|
|
19
|
+
out_file = File.expand_path File.join(tmp_path, iteration.to_s + '.xml')
|
20
|
+
xml_files << out_file
|
21
|
+
spawn_command = %Q("#{command}" --format JUnit --out "#{out_file}")
|
22
|
+
puts "Running: #{spawn_command}"
|
23
|
+
Process::waitpid(POSIX::Spawn::spawn(spawn_command))
|
24
|
+
end
|
25
|
+
|
26
|
+
merge_path = File.join(tmp_path, 'merged.xml')
|
27
|
+
File.open(merge_path, 'w') do |file|
|
28
|
+
xml = RSpecFlake.merge_xml input: xml_files
|
29
|
+
file.write xml
|
30
|
+
puts RSpecFlake.stats_from_merge_xml xml
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module RSpecFlake
|
2
|
+
class << self
|
3
|
+
def stats_from_merge_xml xml_string
|
4
|
+
output = ''
|
5
|
+
|
6
|
+
xml = Nokogiri::XML(xml_string)
|
7
|
+
xml.xpath('//testcase').each do |testcase|
|
8
|
+
# <testcase failures="0" runs="3" name="a a 1" location="./spec/a_spec.rb:6">
|
9
|
+
failures = testcase[:failures]
|
10
|
+
runs = testcase[:runs]
|
11
|
+
name = testcase[:name]
|
12
|
+
location = testcase[:location]
|
13
|
+
|
14
|
+
times = []
|
15
|
+
testcase.xpath('time').each do |time|
|
16
|
+
times << time.content.to_f
|
17
|
+
end
|
18
|
+
|
19
|
+
average_time = (times.inject(:+).to_f / times.size).round 2
|
20
|
+
|
21
|
+
output += "#{name} - runs: #{runs} - failures: #{failures} - avg time: #{average_time} - #{location}\n"
|
22
|
+
end
|
23
|
+
|
24
|
+
output
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/readme.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#### rspec_flake [![Build Status](https://travis-ci.org/bootstraponline/rspec_flake.svg?branch=master)](https://travis-ci.org/bootstraponline/rspec_flake)
|
2
|
+
|
3
|
+
Measure RSpec test flakiness
|
4
|
+
|
5
|
+
#### Design Notes
|
6
|
+
|
7
|
+
`rspec` doesn't enforce unique test names, also test suite names may be reused
|
8
|
+
in different files. The only reliable way to identify a test or suite is by
|
9
|
+
location.
|
10
|
+
|
11
|
+
A nokogiri SAX parser is used to read the junit xml into a hash keyed on
|
12
|
+
location. After that the hash is rewritten and passed to XmlSimple for
|
13
|
+
serilization to xml.
|
14
|
+
|
15
|
+
The value of `errors` is hardcoded to 0 in `jarjuf` because rspec records
|
16
|
+
failures and errors are considered a type of failure.
|
17
|
+
|
18
|
+
#### Example output
|
19
|
+
|
20
|
+
```
|
21
|
+
$ rspec_flake 2 rspec
|
22
|
+
Running: "rspec" --format JUnit --out "/rspec_simple_example/tmp/0.xml"
|
23
|
+
Running: "rspec" --format JUnit --out "/rspec_simple_example/tmp/1.xml"
|
24
|
+
a a 1 - runs: 2 - failures: 0 - avg time: 0.0 - ./spec/a_spec.rb:6
|
25
|
+
a a 2 - runs: 2 - failures: 0 - avg time: 0.0 - ./spec/a_spec.rb:10
|
26
|
+
a a 3 - runs: 2 - failures: 0 - avg time: 0.0 - ./spec/a_spec.rb:13
|
27
|
+
b b 3 - runs: 2 - failures: 0 - avg time: 0.0 - ./spec/b_spec.rb:6
|
28
|
+
b b 4 - runs: 2 - failures: 0 - avg time: 0.0 - ./spec/b_spec.rb:9
|
29
|
+
```
|
data/rspec_flake.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require_relative 'lib/rspec_flake/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
# 1.8.x is not supported
|
6
|
+
s.required_ruby_version = '>= 1.9.3'
|
7
|
+
|
8
|
+
s.name = 'rspec_flake'
|
9
|
+
s.version = RSpecFlake::VERSION
|
10
|
+
s.date = RSpecFlake::DATE
|
11
|
+
s.license = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
12
|
+
s.description = s.summary = 'Measure flaky RSpec tests'
|
13
|
+
s.description += '.' # avoid identical warning
|
14
|
+
s.authors = s.email = %w(code@bootstraponline.com)
|
15
|
+
s.homepage = 'https://github.com/bootstraponline/rspec_flake'
|
16
|
+
s.require_paths = %w(lib)
|
17
|
+
|
18
|
+
s.add_runtime_dependency 'nokogiri', '~> 1.6.5'
|
19
|
+
s.add_runtime_dependency 'xml-simple', '~> 1.1.4'
|
20
|
+
s.add_runtime_dependency 'posix-spawn', '~> 0.3.9'
|
21
|
+
s.add_runtime_dependency 'escape_utils', '~> 1.0.1'
|
22
|
+
|
23
|
+
s.add_development_dependency 'thor', '~> 0.19.1'
|
24
|
+
s.add_development_dependency 'appium_thor', '~> 0.0.7'
|
25
|
+
s.add_development_dependency 'pry', '~> 0.10.1'
|
26
|
+
s.add_development_dependency 'awesome_print', '~> 1.6.1'
|
27
|
+
s.add_development_dependency 'rspec', '~> 3.1.0'
|
28
|
+
s.add_development_dependency 'nokogiri-diff', '~> 0.2.0'
|
29
|
+
|
30
|
+
s.executables = %w(rspec_flake)
|
31
|
+
s.files = `git ls-files`.split "\n"
|
32
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
describe 'convert xml' do
|
2
|
+
it 'should convert successful results' do
|
3
|
+
actual = RSpecFlake.hash_to_xml expected_parsed_0_xml
|
4
|
+
expected = expected_converted_0_xml
|
5
|
+
|
6
|
+
expect(actual).to eq(expected)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should convert failed results' do
|
10
|
+
actual = RSpecFlake.hash_to_xml expected_parsed_failure_xml
|
11
|
+
expected = expected_converted_failure_xml
|
12
|
+
|
13
|
+
expect(actual).to eq(expected)
|
14
|
+
end
|
15
|
+
end
|
data/spec/data/0.xml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<testsuites errors="0" failures="0" skipped="0" tests="4" time="0.001283"
|
3
|
+
timestamp="2015-01-15T10:25:40-05:00">
|
4
|
+
<testsuite location="./spec/a_spec.rb:1" name="a" tests="2" errors="0"
|
5
|
+
failures="0" skipped="0">
|
6
|
+
<properties/>
|
7
|
+
<testcase name="a a 1" time="0.000177" location="./spec/a_spec.rb:6">
|
8
|
+
</testcase>
|
9
|
+
<testcase name="a a 2" time="0.000198" location="./spec/a_spec.rb:10">
|
10
|
+
</testcase>
|
11
|
+
</testsuite>
|
12
|
+
<testsuite location="./spec/b_spec.rb:1" name="b" tests="2" errors="0"
|
13
|
+
failures="0" skipped="0">
|
14
|
+
<properties/>
|
15
|
+
<testcase name="b b 3" time="0.000112" location="./spec/b_spec.rb:6">
|
16
|
+
</testcase>
|
17
|
+
<testcase name="b b 4" time="0.000204" location="./spec/b_spec.rb:10">
|
18
|
+
</testcase>
|
19
|
+
</testsuite>
|
20
|
+
</testsuites>
|
data/spec/data/1.xml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<testsuites errors="0" failures="0" skipped="0" tests="4" time="0.001301"
|
3
|
+
timestamp="2015-01-15T10:25:41-05:00">
|
4
|
+
<testsuite location="./spec/a_spec.rb:1" name="a" tests="2" errors="0"
|
5
|
+
failures="0" skipped="0">
|
6
|
+
<properties/>
|
7
|
+
<testcase name="a a 1" time="0.000217" location="./spec/a_spec.rb:6">
|
8
|
+
</testcase>
|
9
|
+
<testcase name="a a 2" time="0.00015" location="./spec/a_spec.rb:10">
|
10
|
+
</testcase>
|
11
|
+
</testsuite>
|
12
|
+
<testsuite location="./spec/b_spec.rb:1" name="b" tests="2" errors="0"
|
13
|
+
failures="0" skipped="0">
|
14
|
+
<properties/>
|
15
|
+
<testcase name="b b 3" time="0.000171" location="./spec/b_spec.rb:6">
|
16
|
+
</testcase>
|
17
|
+
<testcase name="b b 4" time="0.000148" location="./spec/b_spec.rb:10">
|
18
|
+
</testcase>
|
19
|
+
</testsuite>
|
20
|
+
</testsuites>
|
data/spec/data/2.xml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<testsuites errors="0" failures="0" skipped="0" tests="4" time="0.001294"
|
3
|
+
timestamp="2015-01-15T10:25:41-05:00">
|
4
|
+
<testsuite location="./spec/a_spec.rb:1" name="a" tests="2" errors="0"
|
5
|
+
failures="0" skipped="0">
|
6
|
+
<properties/>
|
7
|
+
<testcase name="a a 1" time="0.000184" location="./spec/a_spec.rb:6">
|
8
|
+
</testcase>
|
9
|
+
<testcase name="a a 2" time="0.000171" location="./spec/a_spec.rb:10">
|
10
|
+
</testcase>
|
11
|
+
</testsuite>
|
12
|
+
<testsuite location="./spec/b_spec.rb:1" name="b" tests="2" errors="0"
|
13
|
+
failures="0" skipped="0">
|
14
|
+
<properties/>
|
15
|
+
<testcase name="b b 3" time="0.00016" location="./spec/b_spec.rb:6">
|
16
|
+
</testcase>
|
17
|
+
<testcase name="b b 4" time="0.000173" location="./spec/b_spec.rb:10">
|
18
|
+
</testcase>
|
19
|
+
</testsuite>
|
20
|
+
</testsuites>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<testsuites errors="0" failures="1" skipped="0" tests="1" time="0.001672"
|
3
|
+
timestamp="2015-01-16T10:14:25-05:00">
|
4
|
+
<testsuite location="./spec/a_spec.rb:1" name="a" tests="1" errors="0"
|
5
|
+
failures="1" skipped="0">
|
6
|
+
<properties/>
|
7
|
+
<testcase name="a a 3" time="0.001008" location="./spec/a_spec.rb:2">
|
8
|
+
<failure message="failed a a 3" type="failed">
|
9
|
+
<![CDATA[
|
10
|
+
expected: 2
|
11
|
+
got: 1
|
12
|
+
|
13
|
+
(compared using ==)
|
14
|
+
|
15
|
+
["./spec/a_spec.rb:4:in `block (2 levels) in <top (required)>'"]]]>
|
16
|
+
</failure>
|
17
|
+
</testcase>
|
18
|
+
</testsuite>
|
19
|
+
</testsuites>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<testsuites errors="0" failures="1" skipped="0" tests="1" time="0.001672"
|
3
|
+
timestamp="2015-01-16T10:14:25-05:00">
|
4
|
+
<testsuite location="./spec/a_spec.rb:1" name="a" tests="1" errors="0"
|
5
|
+
failures="1" skipped="0">
|
6
|
+
<properties/>
|
7
|
+
<testcase name="a a 3" time="0.001008" location="./spec/a_spec.rb:2">
|
8
|
+
<failure message="failed a a 3" type="failed">
|
9
|
+
<![CDATA[
|
10
|
+
expected: 2
|
11
|
+
got: 1
|
12
|
+
|
13
|
+
(compared using ==)
|
14
|
+
|
15
|
+
["./spec/a_spec.rb:4:in `block (2 levels) in <top (required)>'"]]]>
|
16
|
+
</failure>
|
17
|
+
</testcase>
|
18
|
+
</testsuite>
|
19
|
+
</testsuites>
|
data/spec/merge_spec.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
describe 'merge rspec_junit xml' do
|
2
|
+
it 'should merge successfully' do
|
3
|
+
xml_files = %w[0.xml 1.xml 2.xml failure.xml failure2.xml]
|
4
|
+
actual = RSpecFlake.merge_xml input: xml_files.map(&method(:data))
|
5
|
+
expected = expected_merge_xml
|
6
|
+
|
7
|
+
expect(actual).to eq expected
|
8
|
+
end
|
9
|
+
end
|
data/spec/parse_spec.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
describe 'parse rspec_junit xml' do
|
2
|
+
it 'should parse success results' do
|
3
|
+
actual = RSpecFlake.parse_xml data '0.xml'
|
4
|
+
expected = expected_parsed_0_xml
|
5
|
+
|
6
|
+
expect(actual).to eq expected
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should parse failure results' do
|
10
|
+
actual = RSpecFlake.parse_xml data 'failure.xml'
|
11
|
+
expected = expected_parsed_failure_xml
|
12
|
+
|
13
|
+
expect(actual).to eq expected
|
14
|
+
end
|
15
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,220 @@
|
|
1
|
+
require_relative '../lib/rspec_flake'
|
2
|
+
require 'awesome_print'
|
3
|
+
require 'pry'
|
4
|
+
|
5
|
+
Pry.config.command_prefix = "%" if defined?(Pry)
|
6
|
+
|
7
|
+
def data data_path
|
8
|
+
File.expand_path File.join('..', 'data', data_path), __FILE__
|
9
|
+
end
|
10
|
+
|
11
|
+
def expected_stats
|
12
|
+
<<'TEXT'
|
13
|
+
a a 1 - runs: 3 - failures: 0 - avg time: 0.0 - ./spec/a_spec.rb:6
|
14
|
+
a a 2 - runs: 3 - failures: 0 - avg time: 0.0 - ./spec/a_spec.rb:10
|
15
|
+
b b 3 - runs: 3 - failures: 0 - avg time: 0.0 - ./spec/b_spec.rb:6
|
16
|
+
b b 4 - runs: 3 - failures: 0 - avg time: 0.0 - ./spec/b_spec.rb:10
|
17
|
+
a a 3 - runs: 2 - failures: 2 - avg time: 0.0 - ./spec/a_spec.rb:2
|
18
|
+
TEXT
|
19
|
+
end
|
20
|
+
|
21
|
+
def expected_merge_xml
|
22
|
+
<<'XML'
|
23
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
24
|
+
<testsuites>
|
25
|
+
<testsuite>
|
26
|
+
<testcase failures="0" runs="3" name="a a 1" location="./spec/a_spec.rb:6">
|
27
|
+
<time>0.000177</time>
|
28
|
+
<time>0.000217</time>
|
29
|
+
<time>0.000184</time>
|
30
|
+
</testcase>
|
31
|
+
<testcase failures="0" runs="3" name="a a 2" location="./spec/a_spec.rb:10">
|
32
|
+
<time>0.000198</time>
|
33
|
+
<time>0.00015</time>
|
34
|
+
<time>0.000171</time>
|
35
|
+
</testcase>
|
36
|
+
<testcase failures="0" runs="3" name="b b 3" location="./spec/b_spec.rb:6">
|
37
|
+
<time>0.000112</time>
|
38
|
+
<time>0.000171</time>
|
39
|
+
<time>0.00016</time>
|
40
|
+
</testcase>
|
41
|
+
<testcase failures="0" runs="3" name="b b 4" location="./spec/b_spec.rb:10">
|
42
|
+
<time>0.000204</time>
|
43
|
+
<time>0.000148</time>
|
44
|
+
<time>0.000173</time>
|
45
|
+
</testcase>
|
46
|
+
<testcase failures="2" runs="2" name="a a 3" location="./spec/a_spec.rb:2">
|
47
|
+
<time>0.001008</time>
|
48
|
+
<time>0.001008</time>
|
49
|
+
<failure>
|
50
|
+
<![CDATA[
|
51
|
+
expected: 2
|
52
|
+
got: 1
|
53
|
+
|
54
|
+
(compared using ==)
|
55
|
+
|
56
|
+
["./spec/a_spec.rb:4:in `block (2 levels) in <top (required)>'"]]]>
|
57
|
+
</failure>
|
58
|
+
<failure>
|
59
|
+
<![CDATA[
|
60
|
+
expected: 2
|
61
|
+
got: 1
|
62
|
+
|
63
|
+
(compared using ==)
|
64
|
+
|
65
|
+
["./spec/a_spec.rb:4:in `block (2 levels) in <top (required)>'"]]]>
|
66
|
+
</failure>
|
67
|
+
</testcase>
|
68
|
+
</testsuite>
|
69
|
+
</testsuites>
|
70
|
+
XML
|
71
|
+
end
|
72
|
+
|
73
|
+
def expected_converted_0_xml
|
74
|
+
<<'XML'
|
75
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
76
|
+
<testsuites errors="0" failures="0" skipped="0" tests="4" time="0.001283" timestamp="2015-01-15T10:25:40-05:00">
|
77
|
+
<testsuite location="./spec/a_spec.rb:1" name="a" tests="2" errors="0" failures="0" skipped="0">
|
78
|
+
<testcase name="a a 1" time="0.000177" location="./spec/a_spec.rb:6" />
|
79
|
+
<testcase name="a a 2" time="0.000198" location="./spec/a_spec.rb:10" />
|
80
|
+
</testsuite>
|
81
|
+
<testsuite location="./spec/b_spec.rb:1" name="b" tests="2" errors="0" failures="0" skipped="0">
|
82
|
+
<testcase name="b b 3" time="0.000112" location="./spec/b_spec.rb:6" />
|
83
|
+
<testcase name="b b 4" time="0.000204" location="./spec/b_spec.rb:10" />
|
84
|
+
</testsuite>
|
85
|
+
</testsuites>
|
86
|
+
XML
|
87
|
+
end
|
88
|
+
|
89
|
+
def expected_converted_failure_xml
|
90
|
+
<<'XML'
|
91
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
92
|
+
<testsuites errors="0" failures="1" skipped="0" tests="1" time="0.001672" timestamp="2015-01-16T10:14:25-05:00">
|
93
|
+
<testsuite location="./spec/a_spec.rb:1" name="a" tests="1" errors="0" failures="1" skipped="0">
|
94
|
+
<testcase name="a a 3" time="0.001008" location="./spec/a_spec.rb:2">
|
95
|
+
<failure message="failed a a 3" type="failed">
|
96
|
+
<![CDATA[
|
97
|
+
expected: 2
|
98
|
+
got: 1
|
99
|
+
|
100
|
+
(compared using ==)
|
101
|
+
|
102
|
+
["./spec/a_spec.rb:4:in `block (2 levels) in <top (required)>'"]]]>
|
103
|
+
</failure>
|
104
|
+
</testcase>
|
105
|
+
</testsuite>
|
106
|
+
</testsuites>
|
107
|
+
XML
|
108
|
+
end
|
109
|
+
|
110
|
+
def expected_parsed_0_xml
|
111
|
+
{
|
112
|
+
:testsuites => {
|
113
|
+
:attrs => {
|
114
|
+
'errors' => '0',
|
115
|
+
'failures' => '0',
|
116
|
+
'skipped' => '0',
|
117
|
+
'tests' => '4',
|
118
|
+
'time' => '0.001283',
|
119
|
+
'timestamp' => '2015-01-15T10:25:40-05:00'
|
120
|
+
},
|
121
|
+
:testsuite => {
|
122
|
+
'./spec/a_spec.rb:1' => {
|
123
|
+
:attrs => {
|
124
|
+
'location' => './spec/a_spec.rb:1',
|
125
|
+
'name' => 'a',
|
126
|
+
'tests' => '2',
|
127
|
+
'errors' => '0',
|
128
|
+
'failures' => '0',
|
129
|
+
'skipped' => '0'
|
130
|
+
},
|
131
|
+
:testcase => {
|
132
|
+
'./spec/a_spec.rb:6' => {
|
133
|
+
:attrs => {
|
134
|
+
'name' => 'a a 1',
|
135
|
+
'time' => '0.000177',
|
136
|
+
'location' => './spec/a_spec.rb:6'
|
137
|
+
}
|
138
|
+
},
|
139
|
+
'./spec/a_spec.rb:10' => {
|
140
|
+
:attrs => {
|
141
|
+
'name' => 'a a 2',
|
142
|
+
'time' => '0.000198',
|
143
|
+
'location' => './spec/a_spec.rb:10'
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
147
|
+
},
|
148
|
+
'./spec/b_spec.rb:1' => {
|
149
|
+
:attrs => {
|
150
|
+
'location' => './spec/b_spec.rb:1',
|
151
|
+
'name' => 'b',
|
152
|
+
'tests' => '2',
|
153
|
+
'errors' => '0',
|
154
|
+
'failures' => '0',
|
155
|
+
'skipped' => '0'
|
156
|
+
},
|
157
|
+
:testcase => {
|
158
|
+
'./spec/b_spec.rb:6' => {
|
159
|
+
:attrs => {
|
160
|
+
'name' => 'b b 3',
|
161
|
+
'time' => '0.000112',
|
162
|
+
'location' => './spec/b_spec.rb:6'
|
163
|
+
}
|
164
|
+
},
|
165
|
+
'./spec/b_spec.rb:10' => {
|
166
|
+
:attrs => {
|
167
|
+
'name' => 'b b 4',
|
168
|
+
'time' => '0.000204',
|
169
|
+
'location' => './spec/b_spec.rb:10'
|
170
|
+
}
|
171
|
+
}
|
172
|
+
}
|
173
|
+
}
|
174
|
+
}
|
175
|
+
}
|
176
|
+
}
|
177
|
+
end
|
178
|
+
|
179
|
+
def expected_parsed_failure_xml
|
180
|
+
{
|
181
|
+
:testsuites => {
|
182
|
+
:attrs => {
|
183
|
+
"errors" => "0",
|
184
|
+
"failures" => "1",
|
185
|
+
"skipped" => "0",
|
186
|
+
"tests" => "1",
|
187
|
+
"time" => "0.001672",
|
188
|
+
"timestamp" => "2015-01-16T10:14:25-05:00"
|
189
|
+
},
|
190
|
+
:testsuite => {
|
191
|
+
"./spec/a_spec.rb:1" => {
|
192
|
+
:attrs => {
|
193
|
+
"location" => "./spec/a_spec.rb:1",
|
194
|
+
"name" => "a",
|
195
|
+
"tests" => "1",
|
196
|
+
"errors" => "0",
|
197
|
+
"failures" => "1",
|
198
|
+
"skipped" => "0"
|
199
|
+
},
|
200
|
+
:testcase => {
|
201
|
+
"./spec/a_spec.rb:2" => {
|
202
|
+
:attrs => {
|
203
|
+
"name" => "a a 3",
|
204
|
+
"time" => "0.001008",
|
205
|
+
"location" => "./spec/a_spec.rb:2"
|
206
|
+
},
|
207
|
+
:failure => {
|
208
|
+
:attrs => {
|
209
|
+
"message" => "failed a a 3",
|
210
|
+
"type" => "failed"
|
211
|
+
},
|
212
|
+
:content => "\nexpected: 2\n got: 1\n\n(compared using ==)\n\n[\"./spec/a_spec.rb:4:in `block (2 levels) in <top (required)>'\"]"
|
213
|
+
}
|
214
|
+
}
|
215
|
+
}
|
216
|
+
}
|
217
|
+
}
|
218
|
+
}
|
219
|
+
}
|
220
|
+
end
|
data/spec/stats_spec.rb
ADDED
metadata
ADDED
@@ -0,0 +1,212 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec_flake
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- code@bootstraponline.com
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.6.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.6.5
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: xml-simple
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.4
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: posix-spawn
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.3.9
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.3.9
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: escape_utils
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.1
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.19.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.19.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: appium_thor
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.0.7
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.0.7
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.10.1
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.10.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: awesome_print
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.6.1
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.6.1
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 3.1.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 3.1.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: nokogiri-diff
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.2.0
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.2.0
|
153
|
+
description: Measure flaky RSpec tests.
|
154
|
+
email:
|
155
|
+
- code@bootstraponline.com
|
156
|
+
executables:
|
157
|
+
- rspec_flake
|
158
|
+
extensions: []
|
159
|
+
extra_rdoc_files: []
|
160
|
+
files:
|
161
|
+
- ".gitignore"
|
162
|
+
- ".rspec"
|
163
|
+
- ".travis.yml"
|
164
|
+
- Gemfile
|
165
|
+
- LICENSE-2.0.txt
|
166
|
+
- Thorfile
|
167
|
+
- bin/rspec_flake
|
168
|
+
- lib/rspec_flake.rb
|
169
|
+
- lib/rspec_flake/convert.rb
|
170
|
+
- lib/rspec_flake/merge.rb
|
171
|
+
- lib/rspec_flake/parse.rb
|
172
|
+
- lib/rspec_flake/rspec_flake.rb
|
173
|
+
- lib/rspec_flake/stats.rb
|
174
|
+
- lib/rspec_flake/version.rb
|
175
|
+
- readme.md
|
176
|
+
- rspec_flake.gemspec
|
177
|
+
- spec/convert_spec.rb
|
178
|
+
- spec/data/0.xml
|
179
|
+
- spec/data/1.xml
|
180
|
+
- spec/data/2.xml
|
181
|
+
- spec/data/failure.xml
|
182
|
+
- spec/data/failure2.xml
|
183
|
+
- spec/merge_spec.rb
|
184
|
+
- spec/parse_spec.rb
|
185
|
+
- spec/spec_helper.rb
|
186
|
+
- spec/stats_spec.rb
|
187
|
+
homepage: https://github.com/bootstraponline/rspec_flake
|
188
|
+
licenses:
|
189
|
+
- http://www.apache.org/licenses/LICENSE-2.0.txt
|
190
|
+
metadata: {}
|
191
|
+
post_install_message:
|
192
|
+
rdoc_options: []
|
193
|
+
require_paths:
|
194
|
+
- lib
|
195
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ">="
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: 1.9.3
|
200
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
|
+
requirements:
|
202
|
+
- - ">="
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: '0'
|
205
|
+
requirements: []
|
206
|
+
rubyforge_project:
|
207
|
+
rubygems_version: 2.4.3
|
208
|
+
signing_key:
|
209
|
+
specification_version: 4
|
210
|
+
summary: Measure flaky RSpec tests
|
211
|
+
test_files: []
|
212
|
+
has_rdoc:
|