test-unit-runner-junitxml 0.2.0 → 1.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/.github/workflows/test.yml +10 -3
- data/README.ja.md +2 -2
- data/README.md +2 -2
- data/lib/test/unit/runner/junitxml/version.rb +1 -1
- data/lib/test/unit/ui/junitxml/testrunner.rb +11 -3
- data/lib/test/unit/ui/junitxml/xml.erb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d80ec066b99b905b45f634d5f5c77de818136eb4840cc460bc5cd94e1c4b2a6
|
4
|
+
data.tar.gz: a15d2feb6b5cd2cbfc15e9a5187c6f5fd8ef3991bbf4235123ed74fb23553006
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47fe6a5c24941dd8b685e0265008384d5728f239695303371e8bdf356c0c984dbd11dae4bc4a6ffa8eafad37bab796b9ba29dce3aa73f239b13b585cd03549eb
|
7
|
+
data.tar.gz: 7c42cc465c212a4d6fc7ff40485e765e0fe0b200d3a2bb8026d049f40c65518e1a4010c4261d6827ec8fb8ecb0c6aa143cc25394660a4062cc2d0cc87b18003e
|
data/.github/workflows/test.yml
CHANGED
@@ -7,21 +7,28 @@ on:
|
|
7
7
|
schedule:
|
8
8
|
- cron: '34 18 * * *'
|
9
9
|
jobs:
|
10
|
+
ruby-versions:
|
11
|
+
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
10
12
|
rake-test:
|
13
|
+
needs: ruby-versions
|
11
14
|
strategy:
|
12
15
|
fail-fast: false
|
13
16
|
matrix:
|
14
17
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
15
|
-
ruby:
|
18
|
+
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
16
19
|
exclude:
|
17
20
|
- os: windows-latest
|
18
|
-
ruby:
|
21
|
+
ruby: jruby
|
22
|
+
- os: windows-latest
|
23
|
+
ruby: jruby-head
|
19
24
|
- os: windows-latest
|
20
25
|
ruby: truffleruby
|
26
|
+
- os: windows-latest
|
27
|
+
ruby: truffleruby-head
|
21
28
|
runs-on: ${{ matrix.os }}
|
22
29
|
# continue-on-error: ${{ endsWith(matrix.ruby, 'head') }}
|
23
30
|
steps:
|
24
|
-
- uses: actions/checkout@
|
31
|
+
- uses: actions/checkout@v3
|
25
32
|
- uses: ruby/setup-ruby@v1
|
26
33
|
with:
|
27
34
|
ruby-version: ${{ matrix.ruby }}
|
data/README.ja.md
CHANGED
@@ -33,8 +33,8 @@ $ ruby test.rb --runner=junitxml --junitxml-output-file=result.xml
|
|
33
33
|
$ cat result.xml
|
34
34
|
<?xml version="1.0" encoding="UTF-8" ?>
|
35
35
|
<testsuites>
|
36
|
-
<testsuite name="MyTest" tests="1" errors="0" failures="1" skipped="0" time="0.
|
37
|
-
<testcase classname="MyTest" name="test_1(MyTest)" time="0.
|
36
|
+
<testsuite name="MyTest" tests="1" errors="0" failures="1" skipped="0" time="0.0037614">
|
37
|
+
<testcase classname="MyTest" name="test_1(MyTest)" file="test.rb" time="0.0036311" assertions="1">
|
38
38
|
<failure message="<1> expected but was
|
39
39
|
<2>.">Failure:
|
40
40
|
test_1(MyTest) [test.rb:7]:
|
data/README.md
CHANGED
@@ -33,8 +33,8 @@ $ ruby test.rb --runner=junitxml --junitxml-output-file=result.xml
|
|
33
33
|
$ cat result.xml
|
34
34
|
<?xml version="1.0" encoding="UTF-8" ?>
|
35
35
|
<testsuites>
|
36
|
-
<testsuite name="MyTest" tests="1" errors="0" failures="1" skipped="0" time="0.
|
37
|
-
<testcase classname="MyTest" name="test_1(MyTest)" time="0.
|
36
|
+
<testsuite name="MyTest" tests="1" errors="0" failures="1" skipped="0" time="0.0037614">
|
37
|
+
<testcase classname="MyTest" name="test_1(MyTest)" file="test.rb" time="0.0036311" assertions="1">
|
38
38
|
<failure message="<1> expected but was
|
39
39
|
<2>.">Failure:
|
40
40
|
test_1(MyTest) [test.rb:7]:
|
@@ -15,6 +15,7 @@ module Test
|
|
15
15
|
def initialize(suite, options={})
|
16
16
|
super
|
17
17
|
@junit_test_suites = []
|
18
|
+
@base_dir_re = /\A#{Regexp.quote(Dir.pwd)}\//
|
18
19
|
end
|
19
20
|
|
20
21
|
private
|
@@ -49,7 +50,7 @@ module Test
|
|
49
50
|
end
|
50
51
|
|
51
52
|
def test_started(test)
|
52
|
-
test_case = JUnitTestCase.new(test.class.name, test.description)
|
53
|
+
test_case = JUnitTestCase.new(test.class.name, test.description, test_file(test))
|
53
54
|
@junit_test_suites.last << test_case
|
54
55
|
unless @options[:junitxml_disable_output_capture]
|
55
56
|
@stdout_org = $stdout
|
@@ -59,6 +60,12 @@ module Test
|
|
59
60
|
end
|
60
61
|
end
|
61
62
|
|
63
|
+
def test_file(test)
|
64
|
+
file = (test[:source_location] ||
|
65
|
+
test.method(test.method_name).source_location).first
|
66
|
+
file.sub(@base_dir_re, "")
|
67
|
+
end
|
68
|
+
|
62
69
|
def test_finished(test)
|
63
70
|
@junit_test_suites.last.test_cases.last.time = test.elapsed_time
|
64
71
|
unless @options[:junitxml_disable_output_capture]
|
@@ -125,14 +132,15 @@ module Test
|
|
125
132
|
end
|
126
133
|
|
127
134
|
class JUnitTestCase
|
128
|
-
attr_reader :class_name, :name
|
135
|
+
attr_reader :class_name, :name, :file
|
129
136
|
attr_reader :failure, :error, :omission, :pending
|
130
137
|
attr_reader :stdout, :stderr
|
131
138
|
attr_accessor :assertion_count, :time
|
132
139
|
|
133
|
-
def initialize(class_name, name)
|
140
|
+
def initialize(class_name, name, file)
|
134
141
|
@class_name = class_name
|
135
142
|
@name = name
|
143
|
+
@file = file
|
136
144
|
@failure = @error = @omission = @pending = nil
|
137
145
|
@stdout = StringIO.new
|
138
146
|
@stderr = StringIO.new
|
@@ -3,7 +3,7 @@
|
|
3
3
|
% @junit_test_suites.each do |test_suite|
|
4
4
|
<testsuite name="<%=h test_suite.name %>" tests="<%=h test_suite.test_cases.size %>" errors="<%=h test_suite.errors.size %>" failures="<%=h test_suite.failures.size %>" skipped="<%=h test_suite.test_cases.count(&:skipped?) %>" time="<%=h test_suite.time %>">
|
5
5
|
% test_suite.test_cases.each do |test_case|
|
6
|
-
<testcase classname="<%=h test_case.class_name %>" name="<%=h test_case.name %>" time="<%=h test_case.time %>" assertions="<%=h test_case.assertion_count %>">
|
6
|
+
<testcase classname="<%=h test_case.class_name %>" name="<%=h test_case.name %>" file="<%=h test_case.file%>" time="<%=h test_case.time %>" assertions="<%=h test_case.assertion_count %>">
|
7
7
|
% if test_case.error
|
8
8
|
<error message="<%=h test_case.error.message %>" type="<%=h test_case.error.exception.class.name %>"><%=h test_case.error.long_display %></error>
|
9
9
|
% elsif test_case.failure
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-unit-runner-junitxml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OGAWA KenIchi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|