junitdoc 0.1.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 +7 -0
- data/LICENSE +19 -0
- data/README.md +13 -0
- data/bin/junitdoc +3 -0
- data/lib/junitdoc.rb +90 -0
- metadata +77 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6d39040ab51ff9b5b161b2edc954851b5fcba11b
|
4
|
+
data.tar.gz: 894f9ed0e15b84bf515244450b29b2fe36a71302
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f5804c7f3bba313c01233950e6961f2a153b1ca5a2764105e066b8c4bd0fc0332f2c275198c70526839cff8c065be0008484de3c25c3025dd746aecb7d66ed7b
|
7
|
+
data.tar.gz: a2f5341b3bec83688d92d1838425ce6c4c17bda05b72f2fc818f0c004fb74e59120fb110de493383d99d89da2794178fd5b40902f6553658dc66e4766787f287
|
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2015 Guy Royse
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# JUnit Doc
|
2
|
+
|
3
|
+
Installation instructions:
|
4
|
+
|
5
|
+
gem install junitdoc
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
Just run from the command line and pass a list of JUnit XML files you want to
|
10
|
+
turn into a document. I will output to the console an HTML document that looks
|
11
|
+
pretty.
|
12
|
+
|
13
|
+
junitdoc *.xml > unit-tests.HTML
|
data/bin/junitdoc
ADDED
data/lib/junitdoc.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'haml'
|
3
|
+
|
4
|
+
def main
|
5
|
+
files = Dir.glob ARGV
|
6
|
+
data = process_files files
|
7
|
+
doc = render_template data
|
8
|
+
puts doc
|
9
|
+
end
|
10
|
+
|
11
|
+
def process_files files
|
12
|
+
data = {}
|
13
|
+
files.each { |fn| process_file fn, data }
|
14
|
+
data
|
15
|
+
end
|
16
|
+
|
17
|
+
def render_template data
|
18
|
+
engine = Haml::Engine.new(template)
|
19
|
+
engine.render 'teh data', :data => data
|
20
|
+
end
|
21
|
+
|
22
|
+
def process_file fn, data
|
23
|
+
doc = open_document fn
|
24
|
+
doc.xpath('//testcase').each do |testcase|
|
25
|
+
process_testcase testcase, data
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def open_document fn
|
30
|
+
File.open(fn) { |f| Nokogiri::XML(f) }
|
31
|
+
end
|
32
|
+
|
33
|
+
def process_testcase testcase, data
|
34
|
+
test_name = sentencize testcase[:name]
|
35
|
+
package_name = parse_package_name testcase[:classname]
|
36
|
+
class_name = titlize parse_class_name(testcase[:classname])
|
37
|
+
add_to_data test_name, package_name, class_name, data
|
38
|
+
end
|
39
|
+
|
40
|
+
def sentencize s
|
41
|
+
s.split(/(?=[A-Z0-9])/).map(&:downcase).join ' '
|
42
|
+
end
|
43
|
+
|
44
|
+
def titlize s
|
45
|
+
s.split(/(?=[A-Z0-9])/)[0...-1].join ' '
|
46
|
+
end
|
47
|
+
|
48
|
+
def parse_class_name s
|
49
|
+
s.rpartition('.').last
|
50
|
+
end
|
51
|
+
|
52
|
+
def parse_package_name s
|
53
|
+
s.rpartition('.').first
|
54
|
+
end
|
55
|
+
|
56
|
+
def add_to_data test_name, package_name, class_name, data
|
57
|
+
data[package_name] ||= {}
|
58
|
+
data[package_name][class_name] ||= []
|
59
|
+
data[package_name][class_name] << test_name
|
60
|
+
end
|
61
|
+
|
62
|
+
def template
|
63
|
+
%q(
|
64
|
+
!!! 5
|
65
|
+
%html{:lang => 'en'}
|
66
|
+
%head
|
67
|
+
%title JUnit Test Descriptions
|
68
|
+
%style body { font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; margin-left: 20px }
|
69
|
+
%style h1 { font-size: 24px; margin-bottom: 0px }
|
70
|
+
%style h2 { margin-left: 0px; margin-bottom: 0px; font-size: 18px }
|
71
|
+
%style h2 span { font-size: 12px }
|
72
|
+
%style ul { margin-top: 0px }
|
73
|
+
%body
|
74
|
+
%header
|
75
|
+
%h1 Onesite Server-Side Test Suite
|
76
|
+
%section
|
77
|
+
- data.each do |package_name, classes|
|
78
|
+
- classes.each do |class_name, tests|
|
79
|
+
%h2<
|
80
|
+
= class_name
|
81
|
+
%span
|
82
|
+
= "(#{package_name})"
|
83
|
+
%ul
|
84
|
+
- tests.each do |test_name|
|
85
|
+
%li<
|
86
|
+
= test_name
|
87
|
+
)
|
88
|
+
end
|
89
|
+
|
90
|
+
main
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: junitdoc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Guy Royse
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-26 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.3.1
|
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.3.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: haml
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.0.7
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.0.7
|
41
|
+
description: Converts a pile of JUnit XML reports into readable documentation for
|
42
|
+
your favorite product owner
|
43
|
+
email: guy@guyroyse.com
|
44
|
+
executables:
|
45
|
+
- junitdoc
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- LICENSE
|
50
|
+
- README.md
|
51
|
+
- bin/junitdoc
|
52
|
+
- lib/junitdoc.rb
|
53
|
+
homepage: http://rubygems.org/gems/junitdoc
|
54
|
+
licenses:
|
55
|
+
- MIT
|
56
|
+
metadata: {}
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 2.4.6
|
74
|
+
signing_key:
|
75
|
+
specification_version: 4
|
76
|
+
summary: JUnit Doc
|
77
|
+
test_files: []
|