report_builder 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -39
- data/bin/report_builder +40 -5
- data/lib/report_builder.rake +1 -1
- data/lib/report_builder.rb +18 -10
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7462223d91a07ad530b28508a61e2ba209c57941
|
4
|
+
data.tar.gz: 3cbc4727d0ebd816d1317796f5982bf11dcf2abc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 041ab958382106fb7376ff0b935004f3c6de93b36363c437d0daf7bf46aeeac19720f60a21542674705d3bb8996e5c8107f7ce846b734f4edca1fb6caca3b0a5
|
7
|
+
data.tar.gz: d68885802c905240b93527115ddec3b8ad448a485b5e9d21c3fea6aa0dce9943c0763333b4eb3b4e085dc57429138e7c97b5366a02b04b868b3e5af961bdecd6
|
data/README.md
CHANGED
@@ -19,6 +19,16 @@ gem install report_builder
|
|
19
19
|
|
20
20
|
**Note:** Works with cucumber(>= 2.1.0) test results in JSON format.
|
21
21
|
|
22
|
+
### Config Options:
|
23
|
+
|
24
|
+
| Option | Type | Default | Values |
|
25
|
+
|--------|------|---------|--------|
|
26
|
+
| json_path | [String] / [Array] | (current directory) | json files path / array of json files or path |
|
27
|
+
| report_path | [String] | 'test_report' | output file path with file name without extension |
|
28
|
+
| report_types | [Array] | [:html] | :json, :html (output file types) |
|
29
|
+
| report_tabs | [Array] | [:overview, :features] | :overview, :features, :scenarios, :errors (tabs to build) |
|
30
|
+
| compress_images | [Boolean] | false | true / false (If true, the size of HTML report is reduced but takes more time to build report) |
|
31
|
+
|
22
32
|
### Code Examples:
|
23
33
|
|
24
34
|
```ruby
|
@@ -49,46 +59,24 @@ gem install report_builder
|
|
49
59
|
|
50
60
|
```
|
51
61
|
|
52
|
-
###
|
53
|
-
|
54
|
-
* json_path:
|
55
|
-
|
56
|
-
Default: nil (current directory)
|
57
|
-
|
58
|
-
[String] / [Array] Input json file, array of json files/path or json files path
|
59
|
-
|
60
|
-
* report_path:
|
61
|
-
|
62
|
-
Default: 'test_report'
|
63
|
-
|
64
|
-
[String] Output file path with name
|
65
|
-
|
66
|
-
* report_types:
|
67
|
-
|
68
|
-
Default: [:html]
|
69
|
-
|
70
|
-
[Array] Output file types to build, [:json, :html] or ['html', 'json']
|
71
|
-
|
72
|
-
* report_tabs:
|
73
|
-
|
74
|
-
Default: [:overview, :features, :errors]
|
75
|
-
|
76
|
-
[Array] Tabs to build, [:overview, :features, :scenarios, :errors] or ['overview', 'features', 'scenarios', 'errors']
|
77
|
-
|
78
|
-
* compress_images
|
79
|
-
|
80
|
-
Default: false
|
81
|
-
|
82
|
-
[Boolean] Set true to reducing the size of HTML report, Note: If true, takes more time to build report
|
83
|
-
|
62
|
+
### CLI Options:
|
84
63
|
|
64
|
+
| Option | Values | Explanation |
|
65
|
+
|----------------|------------|----------------------------------------------------------|
|
66
|
+
| -s, --source | x,y,z | List of json path or files |
|
67
|
+
| -o, --out | [PATH]NAME | Report path with name without extension |
|
68
|
+
| -f, --format | x,y,z | List of report format - html,json |
|
69
|
+
| -t, --tabs | x,y,z | List of report tabs - overview,features,scenarios,errors |
|
70
|
+
| -c, --compress | | Reduce report size if embedding images |
|
71
|
+
| -h, --help | | Show available command line switches |
|
72
|
+
| -v, --version | | Show gem version |
|
85
73
|
|
86
|
-
###
|
74
|
+
### CLI Example:
|
87
75
|
|
88
76
|
```bash
|
89
77
|
report_builder
|
90
|
-
report_builder 'path/of/json/files/dir'
|
91
|
-
report_builder 'path/of/json/files/dir' 'report_file'
|
78
|
+
report_builder -s 'path/of/json/files/dir'
|
79
|
+
report_builder -s 'path/of/json/files/dir' -o 'report_file'
|
92
80
|
```
|
93
81
|
|
94
82
|
### Rake Example:
|
@@ -102,17 +90,18 @@ Then run rake task report_builder
|
|
102
90
|
|
103
91
|
```bash
|
104
92
|
rake report_builder
|
105
|
-
rake report_builder
|
106
|
-
rake report_builder
|
93
|
+
rake report_builder['path/of/json/files/dir']
|
94
|
+
rake report_builder['path/of/json/files/dir','report_file']
|
107
95
|
```
|
108
96
|
|
109
97
|
## Contributing
|
110
98
|
|
111
|
-
|
99
|
+
We're open to any contribution. It has to be tested properly though.
|
112
100
|
|
113
101
|
## Maintainer
|
114
102
|
|
115
|
-
[Rajat Thareja](http://www.rajatthareja.com)
|
103
|
+
* [Rajat Thareja](http://www.rajatthareja.com)
|
104
|
+
* [Justin Commu](https://github.com/tk8817)
|
116
105
|
|
117
106
|
## License
|
118
107
|
|
data/bin/report_builder
CHANGED
@@ -1,12 +1,47 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require 'optparse'
|
3
4
|
require 'report_builder'
|
4
5
|
|
5
|
-
|
6
|
-
ARGV[2] ||= [:html]
|
7
|
-
ARGV[3] ||= [:overview, :features, :errors]
|
8
|
-
ARGV[4] ||= false
|
6
|
+
options = {:json_path => nil, :report_path => 'test_report', :report_types => [:html], :report_tabs => [:overview, :features], :compress_images => false}
|
9
7
|
|
10
|
-
|
8
|
+
opt_parser = OptionParser.new do |opts|
|
9
|
+
opts.banner = "Usage: \n report_builder [options]"
|
10
|
+
opts.separator 'Configuration options:'
|
11
|
+
|
12
|
+
opts.on('-s','--source x,y,z', Array, 'List of json path or files') do |list|
|
13
|
+
options[:json_path] = list
|
14
|
+
end
|
15
|
+
|
16
|
+
opts.on('-o', '--out [PATH]NAME', String, 'Report path with name without extension') do |report_path|
|
17
|
+
options[:report_path] = report_path
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on('-f','--format x,y,z', Array, 'List of report format - html,json') do |list|
|
21
|
+
options[:report_types] = list
|
22
|
+
end
|
23
|
+
|
24
|
+
opts.on('-t','--tabs x,y,z', Array, 'List of report tabs - overview,features,scenarios,errors') do |list|
|
25
|
+
options[:report_tabs] = list
|
26
|
+
end
|
27
|
+
|
28
|
+
opts.on('-c', '--compress', 'Reduce report size if embedding images') do |compress|
|
29
|
+
options[:compress_images] = compress
|
30
|
+
end
|
31
|
+
|
32
|
+
opts.separator 'Common options:'
|
33
|
+
|
34
|
+
opts.on_tail('-h', '--help', 'Show help') do
|
35
|
+
puts opts
|
36
|
+
exit
|
37
|
+
end
|
38
|
+
|
39
|
+
opts.on_tail('-v','--version', 'Show version') do
|
40
|
+
puts 'ReportBuilder v' + Gem.loaded_specs['report_builder'].version.to_s rescue puts "Something want wrong. \nUse 'gem list report_builder'"
|
41
|
+
exit
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
opt_parser.parse!(ARGV)
|
11
46
|
|
12
47
|
ReportBuilder.build_report options
|
data/lib/report_builder.rake
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
desc 'Rake task to build report'
|
2
2
|
task :report_builder, [:json_path, :report_path, :report_types, :report_tabs, :compress_images] do |t, args|
|
3
|
-
args.with_defaults(:json_path => nil, :report_path => 'test_report', :report_types => [:html], :report_tabs => [:overview, :features
|
3
|
+
args.with_defaults(:json_path => nil, :report_path => 'test_report', :report_types => [:html], :report_tabs => [:overview, :features], :compress_images => false)
|
4
4
|
options = {:json_path => args.json_path, :report_path => args.report_path, :report_types => args.report_types, :report_tabs => args.report_tabs, :compress_images => args.compress_images}
|
5
5
|
ReportBuilder.build_report options
|
6
6
|
end
|
data/lib/report_builder.rb
CHANGED
@@ -54,14 +54,14 @@ class ReportBuilder
|
|
54
54
|
#
|
55
55
|
def self.configure
|
56
56
|
default_options = OpenStruct.new(
|
57
|
-
json_path: nil,
|
58
|
-
report_path: 'test_report',
|
59
|
-
report_types: [:html],
|
60
|
-
report_tabs: [:overview, :features
|
61
|
-
compress_images: false
|
57
|
+
json_path: nil, # [String] / [Array] Input json file, array of json files/path or json files path, (Default current directory)
|
58
|
+
report_path: 'test_report', # [String] Output file path with name
|
59
|
+
report_types: [:html], # [Array] Output file types to build, [:json, :html] or ['html', 'json']
|
60
|
+
report_tabs: [:overview, :features], # [Array] Tabs to build, [:overview, :features, :scenarios, :errors] or ['overview', 'features', 'scenarios', 'errors']
|
61
|
+
compress_images: false # [Boolean] Set true to reducing the size of HTML report, Note: If true, takes more time to build report
|
62
62
|
)
|
63
63
|
yield default_options if block_given?
|
64
|
-
@options = default_options.
|
64
|
+
@options = default_options.marshal_dump
|
65
65
|
end
|
66
66
|
|
67
67
|
#
|
@@ -161,9 +161,9 @@ class ReportBuilder
|
|
161
161
|
build_menu @options[:report_tabs]
|
162
162
|
|
163
163
|
@builder.div(:id => 'overviewTab') do
|
164
|
-
@builder << "<div id='featurePieChart'></div>"
|
165
|
-
@builder << "<div id='scenarioPieChart'></div>"
|
166
|
-
@builder << "<div id='stepPieChart'></div>"
|
164
|
+
@builder << "<div id='featurePieChart' style=\"float:left;width:33%\"></div>"
|
165
|
+
@builder << "<div id='scenarioPieChart' style=\"display:inline-block;width:33%\"></div>"
|
166
|
+
@builder << "<div id='stepPieChart' style=\"float:right;width:33%\"></div>"
|
167
167
|
end if @options[:report_tabs].include? 'overview'
|
168
168
|
|
169
169
|
@builder.div(:id => 'featuresTab') do
|
@@ -483,6 +483,14 @@ class ReportBuilder
|
|
483
483
|
}.values.each_with_object([]) { |group, features|
|
484
484
|
features << group.first.except('elements').merge('elements' => group.map{|feature| feature['elements']}.flatten)
|
485
485
|
}.each{|feature|
|
486
|
+
if feature['elements'][0]['type'] == 'background'
|
487
|
+
(0..feature['elements'].size-1).step(2) do |i|
|
488
|
+
feature['elements'][i]['steps'].each{|step| step['name']+=(' ('+feature['elements'][i]['keyword']+')')}
|
489
|
+
feature['elements'][i+1]['steps'] = feature['elements'][i]['steps'] + feature['elements'][i+1]['steps']
|
490
|
+
feature['elements'][i+1]['before'] = feature['elements'][i]['before'] if feature['elements'][i]['before']
|
491
|
+
end
|
492
|
+
feature['elements'].reject!{|element| element['type'] == 'background'}
|
493
|
+
end
|
486
494
|
feature['elements'].each { |scenario|
|
487
495
|
scenario['before'] ||= []
|
488
496
|
scenario['before'].each { |before|
|
@@ -622,4 +630,4 @@ class ReportBuilder
|
|
622
630
|
:build_error_list, :build_step_error,
|
623
631
|
:build_hook_error, :build_step_hook_error,
|
624
632
|
:build_unique_image, :build_image
|
625
|
-
end
|
633
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: report_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajat Thareja
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -70,7 +70,7 @@ homepage: https://github.com/rajatthareja/ReportBuilder
|
|
70
70
|
licenses:
|
71
71
|
- MIT
|
72
72
|
metadata: {}
|
73
|
-
post_install_message:
|
73
|
+
post_install_message: Thanks for installing!
|
74
74
|
rdoc_options: []
|
75
75
|
require_paths:
|
76
76
|
- lib
|
@@ -78,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: 1.9.1
|
82
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
84
|
- - ">="
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
requirements:
|
88
88
|
- Cucumber >= 2.1.0 test results in JSON format
|
89
89
|
rubyforge_project:
|
90
|
-
rubygems_version: 2.
|
90
|
+
rubygems_version: 2.5.1
|
91
91
|
signing_key:
|
92
92
|
specification_version: 4
|
93
93
|
summary: ReportBuilder
|