jenkins_junit_builder 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +14 -5
- data/lib/jenkins_junit_builder/suite.rb +14 -4
- data/lib/jenkins_junit_builder/version.rb +1 -1
- data/test/test_jenkins_junit_builder.rb +9 -8
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 994d2701265e04807b0ffd2a946b546c28eece4e
|
4
|
+
data.tar.gz: 4ffbaa139ff8456314a698c1cd1a4b4e2d5fc0fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06760cf4398d8b7d015dac98237d398ab1add7145cdb5b6aa401e96dd6a6893f74b79301ff4c9822f2ebd3c098cfb81b901697022a174c540901b64260c84002
|
7
|
+
data.tar.gz: 4b8059ab213b86ef81542528c3048c08d7107fc81169943564c1d405fa3c04ba5d3604fc3411dc6f45ae0a57753251b7dcf01482601b2885ec127a81693bab1a
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -58,8 +58,9 @@ t_failed.system_err.message = 'give me a stacktrace or something'
|
|
58
58
|
|
59
59
|
Add those to the suite:
|
60
60
|
```ruby
|
61
|
-
t_suite
|
62
|
-
t_suite.name
|
61
|
+
t_suite = JenkinsJunitBuilder::Suite.new
|
62
|
+
t_suite.name = 'Testing some cases'
|
63
|
+
t_suite.package = 'Mytest'
|
63
64
|
t_suite.add_case t_passed
|
64
65
|
t_suite.add_case t_failed
|
65
66
|
```
|
@@ -72,9 +73,9 @@ xml_report = t_suite.build_report
|
|
72
73
|
Into this:
|
73
74
|
```xml
|
74
75
|
<testsuites>
|
75
|
-
<testsuite name="Testing some cases">
|
76
|
-
<testcase name="My first test case" time="65" classname="FirstTestSuite"/>
|
77
|
-
<testcase name="My failing functionality" classname="FirstTestSuite">
|
76
|
+
<testsuite name="Testing some cases" package="Mytest">
|
77
|
+
<testcase name="My first test case" time="65" classname="Mytest.FirstTestSuite"/>
|
78
|
+
<testcase name="My failing functionality" classname="Mytest.FirstTestSuite">
|
78
79
|
<failure message="timeout reached"/>
|
79
80
|
<system-out>some thing went wrong</system-out>
|
80
81
|
<system-err>give me a stacktrace or something</system-err>
|
@@ -87,6 +88,12 @@ Please refer to the tests and code for more guidance for the time being.
|
|
87
88
|
|
88
89
|
----------
|
89
90
|
|
91
|
+
##Changelog
|
92
|
+
|
93
|
+
**0.0.3**
|
94
|
+
- Changed require mechanism to be compatible with JRuby 1.7 (and MRI 1.9.3)
|
95
|
+
**0.0.2**
|
96
|
+
- Learned that rubygems have their runtime dependency list in the gemspec (A.K.A first working version)
|
90
97
|
|
91
98
|
## Contributing
|
92
99
|
|
@@ -95,3 +102,5 @@ Please refer to the tests and code for more guidance for the time being.
|
|
95
102
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
96
103
|
4. Push to the branch (`git push origin my-new-feature`)
|
97
104
|
5. Create a new Pull Request
|
105
|
+
|
106
|
+
> Written with [StackEdit](https://stackedit.io/).
|
@@ -5,7 +5,7 @@ require_relative './file_not_found_exception'
|
|
5
5
|
module JenkinsJunitBuilder
|
6
6
|
class Suite
|
7
7
|
|
8
|
-
attr_accessor :name, :report_path, :append_report
|
8
|
+
attr_accessor :name, :report_path, :append_report, :package
|
9
9
|
|
10
10
|
def initialize
|
11
11
|
@cases = []
|
@@ -24,7 +24,7 @@ module JenkinsJunitBuilder
|
|
24
24
|
# build cases
|
25
25
|
builder = Nokogiri::XML::Builder.new do |xml|
|
26
26
|
xml.testsuites {
|
27
|
-
testsuite
|
27
|
+
testsuite = xml.testsuite {
|
28
28
|
@cases.each do |tc|
|
29
29
|
testcase = xml.testcase {
|
30
30
|
if tc.result_has_message?
|
@@ -43,11 +43,21 @@ module JenkinsJunitBuilder
|
|
43
43
|
|
44
44
|
testcase[:name] = tc.name if tc.name.present?
|
45
45
|
testcase[:time] = tc.time if tc.time.present?
|
46
|
-
|
46
|
+
|
47
|
+
testcase[:classname] = package if package.present?
|
48
|
+
if tc.classname.present?
|
49
|
+
if testcase[:classname].present?
|
50
|
+
testcase[:classname] = "#{testcase[:classname]}.#{tc.classname}"
|
51
|
+
else
|
52
|
+
testcase[:classname] = tc.classname
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
47
56
|
end
|
48
57
|
}
|
49
58
|
|
50
|
-
testsuite[:name]
|
59
|
+
testsuite[:name] = name if name.present?
|
60
|
+
testsuite[:package] = package if package.present?
|
51
61
|
}
|
52
62
|
end
|
53
63
|
|
@@ -22,10 +22,10 @@ TXT
|
|
22
22
|
def test_system_message_return_value
|
23
23
|
stack_trace = <<TXT
|
24
24
|
Minitest::Skip: Skipped, no message given
|
25
|
-
/home/ikon/src/git/jenkins_junit_builder/test/test_jenkins_junit_builder.rb:39:in `test_building_new_report'
|
25
|
+
/home/ikon/src/rocksteady/git/jenkins_junit_builder/test/test_jenkins_junit_builder.rb:39:in `test_building_new_report'
|
26
26
|
|
27
27
|
Minitest::Skip: Skipped, no message given
|
28
|
-
/home/ikon/src/git/jenkins_junit_builder/test/test_jenkins_junit_builder.rb:54:in `test_appending_to_existing_report'
|
28
|
+
/home/ikon/src/rocksteady/git/jenkins_junit_builder/test/test_jenkins_junit_builder.rb:54:in `test_appending_to_existing_report'
|
29
29
|
Finished in 0.00272s
|
30
30
|
4 tests, 2 assertions, 0 failures, 0 errors, 2 skips
|
31
31
|
TXT
|
@@ -48,14 +48,15 @@ TXT
|
|
48
48
|
|
49
49
|
t_failed = JenkinsJunitBuilder::Case.new
|
50
50
|
t_failed.name = 'My failing functionality'
|
51
|
-
t_failed.classname = '
|
51
|
+
t_failed.classname = 'SecondTestSuite'
|
52
52
|
t_failed.result = JenkinsJunitBuilder::Case::RESULT_FAILURE
|
53
53
|
t_failed.message = 'timeout reached'
|
54
54
|
t_failed.system_out.message = 'some thing went wrong'
|
55
55
|
t_failed.system_err.message = 'give me a stacktrace or something'
|
56
56
|
|
57
|
-
t_suite
|
58
|
-
t_suite.name
|
57
|
+
t_suite = JenkinsJunitBuilder::Suite.new
|
58
|
+
t_suite.name = 'Testing some cases'
|
59
|
+
t_suite.package = 'first-suite'
|
59
60
|
t_suite.add_case t_passed
|
60
61
|
t_suite.add_case t_failed
|
61
62
|
|
@@ -63,9 +64,9 @@ TXT
|
|
63
64
|
|
64
65
|
expected = <<XML
|
65
66
|
<testsuites>
|
66
|
-
<testsuite name="Testing some cases">
|
67
|
-
<testcase name="My first test case" time="65" classname="FirstTestSuite"/>
|
68
|
-
<testcase name="My failing functionality" classname="
|
67
|
+
<testsuite name="Testing some cases" package="first-suite">
|
68
|
+
<testcase name="My first test case" time="65" classname="first-suite.FirstTestSuite"/>
|
69
|
+
<testcase name="My failing functionality" classname="first-suite.SecondTestSuite">
|
69
70
|
<failure message="timeout reached"/>
|
70
71
|
<system-out>some thing went wrong</system-out>
|
71
72
|
<system-err>give me a stacktrace or something</system-err>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jenkins_junit_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Viktor Vad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -152,10 +152,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
152
|
version: '0'
|
153
153
|
requirements: []
|
154
154
|
rubyforge_project:
|
155
|
-
rubygems_version: 2.
|
155
|
+
rubygems_version: 2.2.2
|
156
156
|
signing_key:
|
157
157
|
specification_version: 4
|
158
158
|
summary: Build test reports in Jenkins CI JUnit XML format.
|
159
159
|
test_files:
|
160
160
|
- test/minitest_helper.rb
|
161
161
|
- test/test_jenkins_junit_builder.rb
|
162
|
+
has_rdoc:
|