minitest-ci 3.0.3 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.rdoc +64 -0
- data/lib/minitest/ci.rb +8 -5
- metadata +57 -70
- data/.autotest +0 -11
- data/.gemtest +0 -0
- data/History.txt +0 -111
- data/Isolate +0 -9
- data/Manifest.txt +0 -10
- data/README.txt +0 -73
- data/Rakefile +0 -16
- data/test/minitest/test_ci.rb +0 -162
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c2729a8517ac10d9febe0425d40fc263a6ec3d6c
|
4
|
+
data.tar.gz: 024571f398527def3e6ddcd37618b85c363bd8a6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 28d66efb28c6f0d529d5cb1eabc91c597d2e3d66a46dd10b3908a3f8ac299025fdd0033903919fbdd2b4a82f824e1366afc084505c83dfab422aa6ad2b767542
|
7
|
+
data.tar.gz: 6bea3a25b0aeb756e27c51e5b5df7e7ccadb36ddde52a6b7f355375bd39be65361ec9462a1eb4f8a8869897977d4e17c68caef9a6fd21a7f1a1946be2f9de785
|
data/README.rdoc
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
= minitest-ci
|
2
|
+
|
3
|
+
{<img src="https://circleci.com/gh/circleci/minitest-ci.svg?style=svg" alt="Circle CI" />}[https://circleci.com/gh/circleci/minitest-ci]
|
4
|
+
|
5
|
+
* https://github.com/circleci/minitest-ci
|
6
|
+
|
7
|
+
== DESCRIPTION:
|
8
|
+
|
9
|
+
Minitest reporter plugin for CircleCI
|
10
|
+
|
11
|
+
This gem was made possible by YP.com
|
12
|
+
|
13
|
+
Records test results and generates XML files (for junit hudson plugin
|
14
|
+
for example) at the end of the test run.
|
15
|
+
|
16
|
+
== USAGE:
|
17
|
+
|
18
|
+
In order to use this gem, add it to your Gemfile:
|
19
|
+
|
20
|
+
gem "minitest-cli"
|
21
|
+
|
22
|
+
To make integration with CircleCI easier, make sure you have a ":test" task defined. You can do simply by adding the following to your Rakefile:
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new do |t|
|
27
|
+
t.pattern = "test/test_*.rb"
|
28
|
+
end
|
29
|
+
|
30
|
+
task :default => :test
|
31
|
+
|
32
|
+
You should be on your way to continuous testing with Minitest and CircleCI!
|
33
|
+
|
34
|
+
For more complicated setups, see below.
|
35
|
+
|
36
|
+
=== Custom setup
|
37
|
+
|
38
|
+
To configure the test output folder, use the "--ci-dir=" option, setting it in
|
39
|
+
TESTOPTS. On CircleCI, you might want to use something like this in your
|
40
|
+
circle.yml:
|
41
|
+
|
42
|
+
test:
|
43
|
+
override:
|
44
|
+
- bundle exec rake test TESTOPTS="--ci-dir=$CIRCLE_TEST_REPORTS/reports":
|
45
|
+
parallel: true
|
46
|
+
files:
|
47
|
+
- test/**/*.rb
|
48
|
+
|
49
|
+
|
50
|
+
**NOTE**: The report directory is cleaned between test runs. To disable:
|
51
|
+
|
52
|
+
# test/helper.rb
|
53
|
+
Minitest::Ci.clean = false
|
54
|
+
|
55
|
+
# Rakefile (optional, but recommended)
|
56
|
+
task :ci_cleanup do
|
57
|
+
require 'minitest/ci'
|
58
|
+
Minitest::Ci.new.start
|
59
|
+
end
|
60
|
+
task :test => %w[ci_cleanup test:one test:two]
|
61
|
+
|
62
|
+
== REQUIREMENTS:
|
63
|
+
|
64
|
+
* Minitest > version 5
|
data/lib/minitest/ci.rb
CHANGED
@@ -4,7 +4,7 @@ require 'cgi'
|
|
4
4
|
module Minitest
|
5
5
|
class Ci
|
6
6
|
|
7
|
-
VERSION = '3.0
|
7
|
+
VERSION = '3.1.0'
|
8
8
|
|
9
9
|
class << self
|
10
10
|
|
@@ -18,10 +18,12 @@ module Minitest
|
|
18
18
|
# Clean the report_dir between test runs? (defaults to true)
|
19
19
|
|
20
20
|
attr_accessor :clean
|
21
|
+
attr_accessor :working_dir
|
21
22
|
end
|
22
23
|
|
23
24
|
self.report_dir = 'test/reports'
|
24
25
|
self.clean = true
|
26
|
+
self.working_dir = Dir.pwd
|
25
27
|
|
26
28
|
attr_accessor :io
|
27
29
|
attr_accessor :options
|
@@ -52,7 +54,7 @@ module Minitest
|
|
52
54
|
|
53
55
|
Dir.chdir report_dir do
|
54
56
|
results.each do |name, resultz|
|
55
|
-
File.open "TEST-#{CGI.escape(name.to_s)}.xml", "w" do |f|
|
57
|
+
File.open "TEST-#{CGI.escape(name.to_s)}.xml"[0, 255], "w" do |f|
|
56
58
|
f.puts generate_results name, resultz
|
57
59
|
end
|
58
60
|
end
|
@@ -81,6 +83,7 @@ module Minitest
|
|
81
83
|
end
|
82
84
|
end
|
83
85
|
|
86
|
+
base = self.class.working_dir + '/'
|
84
87
|
xml = []
|
85
88
|
|
86
89
|
xml << '<?xml version="1.0" encoding="UTF-8"?>'
|
@@ -88,8 +91,8 @@ module Minitest
|
|
88
91
|
[total_time, skips, failures, errors, escape(name), assertions, results.count]
|
89
92
|
|
90
93
|
results.each do |result|
|
91
|
-
xml << " <testcase time='%6f' name=%p assertions='%s'>" %
|
92
|
-
[result.time, escape(result.name), result.assertions]
|
94
|
+
xml << " <testcase time='%6f' file=%p name=%p assertions='%s'>" %
|
95
|
+
[result.time, escape(result.method(result.name).source_location[0].gsub(base, '')), escape(result.name), result.assertions]
|
93
96
|
if failure = result.failure
|
94
97
|
label = failure.result_label.downcase
|
95
98
|
|
@@ -102,7 +105,7 @@ module Minitest
|
|
102
105
|
bt = Minitest::filter_backtrace failure.backtrace
|
103
106
|
|
104
107
|
xml << " <%s type='%s' message=%s>%s" %
|
105
|
-
[label, escape(klass), escape(msg).inspect, escape(bt.join("\n"))]
|
108
|
+
[label, escape(klass), escape(msg).inspect.gsub('\n', " "), escape(bt.join("\n"))]
|
106
109
|
xml << " </%s>" % label
|
107
110
|
end
|
108
111
|
xml << " </testcase>"
|
metadata
CHANGED
@@ -1,151 +1,138 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-ci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
5
|
-
prerelease:
|
4
|
+
version: 3.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
-
|
7
|
+
- bhenderson
|
8
|
+
- notnoop
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-09-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
17
|
requirements:
|
19
|
-
- -
|
18
|
+
- - ">="
|
20
19
|
- !ruby/object:Gem::Version
|
21
20
|
version: 5.0.6
|
22
|
-
- - ~>
|
21
|
+
- - "~>"
|
23
22
|
- !ruby/object:Gem::Version
|
24
23
|
version: '5.0'
|
25
24
|
type: :runtime
|
26
25
|
prerelease: false
|
27
26
|
version_requirements: !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
27
|
requirements:
|
30
|
-
- -
|
28
|
+
- - ">="
|
31
29
|
- !ruby/object:Gem::Version
|
32
30
|
version: 5.0.6
|
33
|
-
- - ~>
|
31
|
+
- - "~>"
|
34
32
|
- !ruby/object:Gem::Version
|
35
33
|
version: '5.0'
|
36
34
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
35
|
+
name: bundler
|
38
36
|
requirement: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
37
|
requirements:
|
41
|
-
- - ~>
|
38
|
+
- - "~>"
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version: 1.
|
40
|
+
version: '1.13'
|
44
41
|
type: :development
|
45
42
|
prerelease: false
|
46
43
|
version_requirements: !ruby/object:Gem::Requirement
|
47
|
-
none: false
|
48
44
|
requirements:
|
49
|
-
- - ~>
|
45
|
+
- - "~>"
|
50
46
|
- !ruby/object:Gem::Version
|
51
|
-
version: 1.
|
47
|
+
version: '1.13'
|
52
48
|
- !ruby/object:Gem::Dependency
|
53
|
-
name:
|
49
|
+
name: rake
|
54
50
|
requirement: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
51
|
requirements:
|
57
|
-
- -
|
52
|
+
- - "~>"
|
58
53
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
54
|
+
version: 11.1.2
|
60
55
|
type: :development
|
61
56
|
prerelease: false
|
62
57
|
version_requirements: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
58
|
requirements:
|
65
|
-
- -
|
59
|
+
- - "~>"
|
66
60
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
61
|
+
version: 11.1.2
|
68
62
|
- !ruby/object:Gem::Dependency
|
69
|
-
name:
|
63
|
+
name: nokogiri
|
70
64
|
requirement: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
65
|
requirements:
|
73
|
-
- -
|
66
|
+
- - "~>"
|
74
67
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
68
|
+
version: 1.5.0
|
76
69
|
type: :development
|
77
70
|
prerelease: false
|
78
71
|
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
none: false
|
80
72
|
requirements:
|
81
|
-
- -
|
73
|
+
- - "~>"
|
82
74
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
75
|
+
version: 1.5.0
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: rdoc
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.4.2
|
83
|
+
type: :development
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.4.2
|
84
90
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
91
|
+
name: ZenTest
|
86
92
|
requirement: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
93
|
requirements:
|
89
|
-
- -
|
94
|
+
- - ">="
|
90
95
|
- !ruby/object:Gem::Version
|
91
|
-
version: '
|
96
|
+
version: '0'
|
92
97
|
type: :development
|
93
98
|
prerelease: false
|
94
99
|
version_requirements: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
100
|
requirements:
|
97
|
-
- -
|
101
|
+
- - ">="
|
98
102
|
- !ruby/object:Gem::Version
|
99
|
-
version: '
|
100
|
-
description:
|
101
|
-
|
102
|
-
|
103
|
-
This gem was made possible by YP.com'
|
103
|
+
version: '0'
|
104
|
+
description: Minitest Junit XML results that CircleCI can read.
|
104
105
|
email:
|
105
|
-
-
|
106
|
+
- sayhi@circleci.com
|
106
107
|
executables: []
|
107
108
|
extensions: []
|
108
|
-
extra_rdoc_files:
|
109
|
-
- History.txt
|
110
|
-
- Manifest.txt
|
111
|
-
- README.txt
|
109
|
+
extra_rdoc_files: []
|
112
110
|
files:
|
113
|
-
- .
|
114
|
-
- History.txt
|
115
|
-
- Isolate
|
116
|
-
- Manifest.txt
|
117
|
-
- README.txt
|
118
|
-
- Rakefile
|
111
|
+
- README.rdoc
|
119
112
|
- lib/autotest/minitest_ci.rb
|
120
113
|
- lib/minitest/ci.rb
|
121
114
|
- lib/minitest/ci_plugin.rb
|
122
|
-
|
123
|
-
- .gemtest
|
124
|
-
homepage: https://github.com/bhenderson/minitest-ci
|
115
|
+
homepage: https://github.com/circleci/minitest-ci
|
125
116
|
licenses: []
|
117
|
+
metadata: {}
|
126
118
|
post_install_message:
|
127
|
-
rdoc_options:
|
128
|
-
- --main
|
129
|
-
- README.txt
|
119
|
+
rdoc_options: []
|
130
120
|
require_paths:
|
131
121
|
- lib
|
132
122
|
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
-
none: false
|
134
123
|
requirements:
|
135
|
-
- -
|
124
|
+
- - ">="
|
136
125
|
- !ruby/object:Gem::Version
|
137
126
|
version: '0'
|
138
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
128
|
requirements:
|
141
|
-
- -
|
129
|
+
- - ">="
|
142
130
|
- !ruby/object:Gem::Version
|
143
|
-
version:
|
131
|
+
version: 1.3.6
|
144
132
|
requirements: []
|
145
|
-
rubyforge_project:
|
146
|
-
rubygems_version:
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 2.6.6
|
147
135
|
signing_key:
|
148
|
-
specification_version:
|
149
|
-
summary:
|
150
|
-
test_files:
|
151
|
-
- test/minitest/test_ci.rb
|
136
|
+
specification_version: 4
|
137
|
+
summary: Minitest JUnit XML formatter
|
138
|
+
test_files: []
|
data/.autotest
DELETED
data/.gemtest
DELETED
File without changes
|
data/History.txt
DELETED
@@ -1,111 +0,0 @@
|
|
1
|
-
=== 3.0.3 / 2013-10-08
|
2
|
-
|
3
|
-
* 1 unknown:
|
4
|
-
|
5
|
-
* Escape suite and testcase name. (statianzo) #12
|
6
|
-
|
7
|
-
|
8
|
-
=== 3.0.2 / 2013-08-19
|
9
|
-
|
10
|
-
* 4 unknowns:
|
11
|
-
|
12
|
-
* Fix --ci-dir option.
|
13
|
-
* Fix --ci-dir option.
|
14
|
-
* Merge pull request #11 from zcrowell/patch-1
|
15
|
-
* Trying to specify TESTOPTS="--ci-dir=foo" results in OptionParser::NeedlessArgument because --ci-dir is missing a mandatory argument.
|
16
|
-
|
17
|
-
|
18
|
-
=== 3.0.1 / 2013-07-12
|
19
|
-
|
20
|
-
* 1 unknown:
|
21
|
-
|
22
|
-
* Fix Ci class after changes to Reporter. (ferrous26) #9
|
23
|
-
|
24
|
-
|
25
|
-
=== 3.0.0 / 2013-07-03
|
26
|
-
|
27
|
-
* 1 major enhancement:
|
28
|
-
|
29
|
-
* Retool to support minitest 5.
|
30
|
-
|
31
|
-
* 1 bug fix:
|
32
|
-
|
33
|
-
* Use inspect to correctly escape test/class names. (eentzel) Fixes #8
|
34
|
-
|
35
|
-
* 5 unknowns:
|
36
|
-
|
37
|
-
* Add autotest plugin.
|
38
|
-
* Add notes to autotest plugin.
|
39
|
-
* Update readme to reflect changes.
|
40
|
-
* Use Isolate file.
|
41
|
-
* Use error label.
|
42
|
-
|
43
|
-
|
44
|
-
=== 2.4.0 / 2012-11-10
|
45
|
-
This release let's people use either 3.x or 4.x as 4.x doesn't break the
|
46
|
-
needed api
|
47
|
-
|
48
|
-
* 1 unknown:
|
49
|
-
|
50
|
-
* Broaden minitest dependency (millgmi #7)
|
51
|
-
|
52
|
-
|
53
|
-
=== 2.3.1 / 2012-11-10
|
54
|
-
|
55
|
-
* 1 bug fix:
|
56
|
-
|
57
|
-
* Fix generate_suite to report number of errors correctly (millgmi). fix #7
|
58
|
-
|
59
|
-
|
60
|
-
=== 2.3.0 / 2012-07-19
|
61
|
-
|
62
|
-
* 1 minor enhancement:
|
63
|
-
|
64
|
-
* Adds zentest as devdep. Forces gem of minitest
|
65
|
-
|
66
|
-
* 4 unknowns:
|
67
|
-
|
68
|
-
* Adds hoe-version.
|
69
|
-
* CGI.escape suite name in generated filename. Fixes #5.
|
70
|
-
* Edited to remove second require of cgi.
|
71
|
-
* I was seeing the wrong version of minitest being loaded in rake multi.
|
72
|
-
|
73
|
-
|
74
|
-
=== 2.2.0 / 2012-05-10
|
75
|
-
This release was created separate from 2.1.0 incase people don't want to upgrade to 3.0 (why?)
|
76
|
-
|
77
|
-
* 1 minor enhancement
|
78
|
-
|
79
|
-
* Bumps minitest dep to latest version.
|
80
|
-
|
81
|
-
* 1 unknowns:
|
82
|
-
|
83
|
-
* Updates .gitignore for pkg dir.
|
84
|
-
|
85
|
-
=== 2.1.0 / 2012-05-10
|
86
|
-
* 1 minor enhancement
|
87
|
-
|
88
|
-
* Adds ability to disable cleaning report dir. #2
|
89
|
-
|
90
|
-
* 1 bug fix
|
91
|
-
|
92
|
-
* Uses M::Unit::after_tests instead of M::Unit#status to trigger finish method. Fixes #3
|
93
|
-
|
94
|
-
* 6 unknowns:
|
95
|
-
|
96
|
-
* @report_dir doesn't need to be initialized here because I do it a few lines later.
|
97
|
-
* Changes clean switch to positive accessor. #2
|
98
|
-
* Cleans up init variables. Removes runner reset. Appeases warning.
|
99
|
-
* Removes cruft
|
100
|
-
|
101
|
-
=== 2.0.0 / 2012-04-15
|
102
|
-
* 1 major enhancement
|
103
|
-
|
104
|
-
* Updates to use #record method from newer MiniTest. Removes copied code, yay!
|
105
|
-
|
106
|
-
=== 1.0.0 / 2011-09-23
|
107
|
-
|
108
|
-
* 1 major enhancement
|
109
|
-
|
110
|
-
* Birthday!
|
111
|
-
|
data/Isolate
DELETED
data/Manifest.txt
DELETED
data/README.txt
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
= minitest-ci
|
2
|
-
|
3
|
-
* https://github.com/bhenderson/minitest-ci
|
4
|
-
|
5
|
-
== DESCRIPTION:
|
6
|
-
|
7
|
-
CI reporter plugin for Minitest
|
8
|
-
|
9
|
-
This gem was made possible by YP.com
|
10
|
-
|
11
|
-
== FEATURES/PROBLEMS:
|
12
|
-
|
13
|
-
* Uses Minitest::Reporter which is only available since version 5
|
14
|
-
|
15
|
-
== SYNOPSIS:
|
16
|
-
|
17
|
-
require 'minitest/ci'
|
18
|
-
|
19
|
-
Records test results and generates XML files (for junit hudson plugin
|
20
|
-
for example) at the end of the test run. The report directory is cleaned
|
21
|
-
between test runs. To disable:
|
22
|
-
|
23
|
-
# test/helper.rb
|
24
|
-
Minitest::Ci.clean = false
|
25
|
-
|
26
|
-
# Rakefile (optional, but recommended!)
|
27
|
-
task :ci_cleanup do
|
28
|
-
require 'minitest/ci'
|
29
|
-
Minitest::Ci.new.start
|
30
|
-
end
|
31
|
-
task :test => %w[ci_cleanup test:one test:two]
|
32
|
-
|
33
|
-
== REQUIREMENTS:
|
34
|
-
|
35
|
-
* See Rakefile
|
36
|
-
|
37
|
-
== INSTALL:
|
38
|
-
|
39
|
-
* gem install minitest-ci
|
40
|
-
|
41
|
-
== DEVELOPERS:
|
42
|
-
|
43
|
-
After checking out the source, run:
|
44
|
-
|
45
|
-
$ rake newb
|
46
|
-
|
47
|
-
This task will install any missing dependencies, run the tests/specs,
|
48
|
-
and generate the RDoc.
|
49
|
-
|
50
|
-
== LICENSE:
|
51
|
-
|
52
|
-
(The MIT License)
|
53
|
-
|
54
|
-
Copyright (c) 2011 bhenderson
|
55
|
-
|
56
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
57
|
-
a copy of this software and associated documentation files (the
|
58
|
-
'Software'), to deal in the Software without restriction, including
|
59
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
60
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
61
|
-
permit persons to whom the Software is furnished to do so, subject to
|
62
|
-
the following conditions:
|
63
|
-
|
64
|
-
The above copyright notice and this permission notice shall be
|
65
|
-
included in all copies or substantial portions of the Software.
|
66
|
-
|
67
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
68
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
69
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
70
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
71
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
72
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
73
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'hoe'
|
5
|
-
require 'isolate/rake'
|
6
|
-
|
7
|
-
Hoe.plugin :isolate
|
8
|
-
Hoe.plugin :version, :git
|
9
|
-
|
10
|
-
Hoe.spec 'minitest-ci' do
|
11
|
-
developer 'Brian Henderson', 'bhenderson@attinteractive.com'
|
12
|
-
|
13
|
-
self.testlib = :none
|
14
|
-
end
|
15
|
-
|
16
|
-
# vim: syntax=ruby
|
data/test/minitest/test_ci.rb
DELETED
@@ -1,162 +0,0 @@
|
|
1
|
-
gem 'minitest'
|
2
|
-
require "minitest/autorun"
|
3
|
-
require "minitest/ci"
|
4
|
-
|
5
|
-
require 'stringio'
|
6
|
-
require 'nokogiri'
|
7
|
-
|
8
|
-
class MockTestSuite < Minitest::Test
|
9
|
-
def test_raise_error
|
10
|
-
raise 'raise an error'
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_fail_assertion
|
14
|
-
flunk 'fail assertion'
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_skip_assertion
|
18
|
-
skip 'skip assertion'
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_pass
|
22
|
-
pass
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_invalid_characters_in_message
|
26
|
-
raise Object.new.inspect
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_invalid_error_name
|
30
|
-
raise Class.new(Exception)
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_escaping_failure_message
|
34
|
-
flunk "failed: doesn't like single or \"double\" quotes or symbols such as <"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "spec/with::'punctuation'" do
|
39
|
-
it "passes" do
|
40
|
-
pass
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe "spec/with::\"doublequotes\"" do
|
45
|
-
it 'will "pass"' do
|
46
|
-
pass
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# better way?
|
51
|
-
$ci_io = StringIO.new
|
52
|
-
Minitest::Ci.clean = false
|
53
|
-
|
54
|
-
# setup test files
|
55
|
-
reporter = Minitest::Ci.new $ci_io
|
56
|
-
reporter.start
|
57
|
-
Minitest.__run reporter, {}
|
58
|
-
reporter.report
|
59
|
-
|
60
|
-
Minitest::Runnable.reset
|
61
|
-
|
62
|
-
class TestMinitest; end
|
63
|
-
class TestMinitest::TestCi < Minitest::Test
|
64
|
-
|
65
|
-
def output
|
66
|
-
$ci_io
|
67
|
-
end
|
68
|
-
|
69
|
-
def setup
|
70
|
-
file = "test/reports/TEST-MockTestSuite.xml"
|
71
|
-
@file = File.read file
|
72
|
-
@doc = Nokogiri.parse @file
|
73
|
-
@doc = @doc.at_xpath('/testsuite')
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_testsuite
|
77
|
-
assert_equal "1", @doc['skipped']
|
78
|
-
assert_equal "2", @doc['failures']
|
79
|
-
assert_equal "3", @doc['errors']
|
80
|
-
assert_equal "3", @doc['assertions']
|
81
|
-
assert_equal "7", @doc['tests']
|
82
|
-
assert_equal "MockTestSuite", @doc['name']
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_testcase_count
|
86
|
-
assert_equal 7, @doc.children.count {|c| Nokogiri::XML::Element === c}
|
87
|
-
@doc.children.each do |c|
|
88
|
-
next unless Nokogiri::XML::Element === c
|
89
|
-
assert_equal 'testcase', c.name
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_testcase_passed
|
94
|
-
passed = @doc.at_xpath('/testsuite/testcase[@name="test_pass"]')
|
95
|
-
assert_equal 0, passed.children.count {|c| Nokogiri::XML::Element === c}
|
96
|
-
assert_equal '1', passed['assertions']
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_testcase_skipped
|
100
|
-
skipped = @doc.at_xpath('/testsuite/testcase[@name="test_skip_assertion"]')
|
101
|
-
assert_equal 'skip assertion', skipped.at_xpath('skipped')['message']
|
102
|
-
assert_equal '0', skipped['assertions']
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_testcase_failures
|
106
|
-
failure = @doc.at_xpath('/testsuite/testcase[@name="test_fail_assertion"]')
|
107
|
-
assert_equal 'fail assertion', failure.at_xpath('failure')['message']
|
108
|
-
assert_equal '1', failure['assertions']
|
109
|
-
end
|
110
|
-
|
111
|
-
def test_testcase_errors
|
112
|
-
error = @doc.at_xpath('/testsuite/testcase[@name="test_raise_error"]')
|
113
|
-
assert_equal 'raise an error', error.at_xpath('error')['message']
|
114
|
-
assert_equal '0', error['assertions']
|
115
|
-
end
|
116
|
-
|
117
|
-
def test_testcase_error_with_invalid_chars
|
118
|
-
error = @doc.at_xpath('/testsuite/testcase[@name="test_invalid_characters_in_message"]')
|
119
|
-
assert_match( /^#<Object/, error.at_xpath('error')['message'] )
|
120
|
-
assert_equal '0', error['assertions']
|
121
|
-
end
|
122
|
-
|
123
|
-
def test_testcase_error_with_invalid_name
|
124
|
-
error = @doc.at_xpath('/testsuite/testcase[@name="test_invalid_error_name"]')
|
125
|
-
assert_match( /^#<Class/, error.at_xpath('error')['message'] )
|
126
|
-
assert_equal '0', error['assertions']
|
127
|
-
end
|
128
|
-
|
129
|
-
def test_testcase_error_with_bad_chars
|
130
|
-
error = @doc.at_xpath('/testsuite/testcase[@name="test_escaping_failure_message"]')
|
131
|
-
msg = "failed: doesn't like single or \"double\" quotes or symbols such as <"
|
132
|
-
assert_equal msg, error.at_xpath('failure')['message']
|
133
|
-
assert_equal '1', error['assertions']
|
134
|
-
end
|
135
|
-
|
136
|
-
def test_output
|
137
|
-
output.rewind
|
138
|
-
expected = "\ngenerating ci files\n"
|
139
|
-
assert_equal expected, output.read
|
140
|
-
end
|
141
|
-
|
142
|
-
def test_filtering_backtraces
|
143
|
-
error = @doc.at_xpath('/testsuite/testcase[@name="test_raise_error"]')
|
144
|
-
refute_match( /lib\/minitest/, error.inner_text )
|
145
|
-
end
|
146
|
-
|
147
|
-
def test_suitename_with_single_quotes
|
148
|
-
file = File.read "test/reports/TEST-spec%2Fwith%3A%3A%27punctuation%27.xml"
|
149
|
-
suite = Nokogiri.parse(file).at_xpath('/testsuite')
|
150
|
-
assert_equal "spec/with::'punctuation'", suite['name']
|
151
|
-
end
|
152
|
-
|
153
|
-
def test_suitename_with_double_quotes
|
154
|
-
file = File.read "test/reports/TEST-spec%2Fwith%3A%3A%22doublequotes%22.xml"
|
155
|
-
doc = Nokogiri.parse(file)
|
156
|
-
suite = doc.at_xpath('/testsuite')
|
157
|
-
testcase = doc.at_xpath('/testsuite/testcase')
|
158
|
-
|
159
|
-
assert_equal 'spec/with::"doublequotes"', suite['name']
|
160
|
-
assert_equal 'test_0001_will "pass"', testcase['name']
|
161
|
-
end
|
162
|
-
end
|