report_builder 1.2 → 1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9863bb61c867e174d7eb72a11753742b4d8ffaa
4
- data.tar.gz: 1d2fc605738472f645bda76e01ecd72bd6f33687
3
+ metadata.gz: 315748504568c9c1ab74986ef3b436cbe62c836e
4
+ data.tar.gz: 577abdb1da309254a44f60e629d2c1839b675075
5
5
  SHA512:
6
- metadata.gz: 20491fa5730f4bd28ce944b5d4a6b7ae44cfb2ac1469d62aa6990564f0888736f934bb8235a8facab8f7594f275074fc8c1afff36d7463a9f59b3c76c8eb1a1e
7
- data.tar.gz: 773c9a288a135acbecf724aa8997668e7f4069f819aa541945b9e193c393a3f46e8b77c91c0accc15734c4eb02fc70d8d502329de331d1488b7f00dd237c254e
6
+ metadata.gz: 5b7d081033b5e69b62ed4d811e62d853ef5d8ec1f75ad73707c6715507c2ba618bed13ba15f3067742934103758502ddd08248682a5ced053cd8b8b94997829a
7
+ data.tar.gz: 70a64740b7df9ba6ee7ca2b373cf25abecab23fc7b645e167dde87bd644ad04d724c95ec276c56e5058dcd98e2da699f87183785aa0198d3f700bcf8a249831d
data/.gitignore CHANGED
@@ -1,7 +1,6 @@
1
1
  pkg/
2
2
  .idea/
3
3
  .DS_Store
4
- temp/
5
4
  Gemfile.lock
6
5
  doc/
7
6
  .yardoc/
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ os:
2
+ - linux
3
+ - osx
4
+
5
+ language: ruby
6
+ rvm:
7
+ - 1.9.3
8
+ - 2.4.0
9
+ - jruby-9.1.7.0
10
+
11
+ before_install:
12
+ # Using a recent version of bundler in order to avoid gem installation errors
13
+ - gem install bundler -v 1.15.4
14
+
15
+ script: bundle exec rake report_builder:test_everything
data/CHANGELOG.md ADDED
@@ -0,0 +1,43 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
+
6
+ ## [Unreleased](https://github.com/rajatthareja/ReportBuilder/compare/v1.3...master)
7
+
8
+ ## [1.3](https://github.com/rajatthareja/ReportBuilder/compare/v1.2...v1.3) - 2017-10-22
9
+ ### Changed
10
+ - Step Data Table UI
11
+
12
+ ### Added
13
+ - additional_js option
14
+ - additional_css option
15
+ - alias input_path for json_path
16
+ - Duration for Step, Scenario and Feature
17
+ - Search and Filter Scenario by Tag
18
+ - Changelog file
19
+
20
+ ## [1.2](https://github.com/rajatthareja/ReportBuilder/compare/v1.1...v1.2) - 2017-10-10
21
+ ### Added
22
+ - Scenario URI in Report UI
23
+
24
+ ### Fixed
25
+ - Embedding Issues Fixed
26
+
27
+ ## [1.1](https://github.com/rajatthareja/ReportBuilder/compare/v1.0...v1.1) - 2017-10-7
28
+ ### Fixed
29
+ - Decode Embedding Fixed
30
+
31
+ ## [1.0](https://github.com/rajatthareja/ReportBuilder/compare/v0.1.6...v1.0) - 2017-10-4
32
+ ### Changed
33
+ - New Report UI
34
+ - Builder to ERB
35
+ - Local resources to CDN
36
+
37
+ ### Added
38
+ - include_images option
39
+ - New sample report
40
+
41
+ ### Removed
42
+ - report_tabs option
43
+ - compress_images option
data/README.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # ReportBuilder
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/report_builder.svg)](https://badge.fury.io/rb/report_builder)
4
+ [![Build status](https://travis-ci.org/rajatthareja/ReportBuilder.svg?branch=master)](https://travis-ci.org/rajatthareja/ReportBuilder)
4
5
  [![Join the chat at https://gitter.im/rajatthareja/ReportBuilder](https://badges.gitter.im/rajatthareja/ReportBuilder.svg)](https://gitter.im/rajatthareja/ReportBuilder?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5
6
 
6
7
  Ruby gem to merge Cucumber JSON reports and build mobile friendly HTML Test Report, JSON report and retry file.
7
8
 
8
- [View sample report](http://reportbuilder.rajatthareja.com/)
9
+ **[View sample report](http://reportbuilder.rajatthareja.com)**
9
10
 
10
11
  ## Installation
11
12
 
@@ -26,14 +27,18 @@ gem install report_builder
26
27
 
27
28
  ### Config Options:
28
29
 
29
- | Option | Type | Default | Values |
30
- |--------|------|---------|--------|
31
- | json_path | [String] / [Array] | (current directory) | json files path / array of json files or path |
32
- | report_path | [String] | 'test_report' | output file path with file name without extension |
33
- | report_types | [Array] | [:html] | :json, :html, :retry (output file types) |
34
- | report_title | [String] | 'Test Results' | report and html title |
35
- | include_images | [Boolean] | true | true / false (If false, the size of HTML report is reduced by excluding embedded images) |
36
- | additional_info | [Hash] | {} | additional info for report summary |
30
+ | Option | Type | Default | Values |
31
+ |-------------------------|--------------------|---------------------|------------------------------------------------------------------------------------------|
32
+ | json_path / input_path | [String] / [Array] | (current directory) | input json files path / array of json files or path |
33
+ | report_path | [String] | 'test_report' | reports output file path with file name without extension |
34
+ | json_report_path | [String] | (report_path) | json report output file path with file name without extension |
35
+ | html_report_path | [String] | (report_path) | html report output file path with file name without extension |
36
+ | retry_report_path | [String] | (report_path) | retry report output file path with file name without extension |
37
+ | report_types | [Array] | [:html] | :json, :html, :retry (output file types) |
38
+ | report_title | [String] | 'Test Results' | report and html title |
39
+ | include_images | [Boolean] | true | true / false (If false, the size of HTML report is reduced by excluding embedded images) |
40
+ | additional_info | [Hash] | {} | additional info for report summary |
41
+ | additional_css | [String] | nil | additional CSS string or CSS file path or CSS file url for customizing html report |
37
42
 
38
43
  ### Code Examples:
39
44
 
@@ -69,19 +74,20 @@ gem install report_builder
69
74
 
70
75
  ### CLI Options:
71
76
 
72
- | Option | Values | Explanation |
73
- |----------------|-------------|-------------------------------------------------------------------|
74
- | -s, --source | x,y,z | List of json path or files |
75
- | -o, --out | [PATH]NAME | Report path with name without extension |
76
- | --json_out | [PATH]NAME | Same as the -o option but will only apply the json report format |
77
- | --html_out | [PATH]NAME | Same as the -o option but will only apply the html report format |
78
- | --retry_out | [PATH]NAME | Same as the -o option but will only apply the retry report format |
79
- | -f, --format | x,y,z | List of report format - html,json,retry |
80
- | --[no-]images | | Reduce HTML report size by excluding embedded images |
81
- | -T, --title | TITLE | Report title |
82
- | -I, --info | a:x,b:y,c:z | List of additional info about test - key:value |
83
- | -h, --help | | Show available command line switches |
84
- | -v, --version | | Show gem version |
77
+ | Option | Values | Explanation |
78
+ |---------------------|-----------------|------------------------------------------------------------------------------------|
79
+ | -s, --source | x,y,z | List of input json path or files |
80
+ | -o, --out | [PATH]NAME | Reports path with name without extension |
81
+ | --json_out | [PATH]NAME | JSON report path with name without extension |
82
+ | --html_out | [PATH]NAME | HTML report path with name without extension |
83
+ | --retry_out | [PATH]NAME | Retry report path with name without extension |
84
+ | -f, --format | x,y,z | List of report format - html,json,retry |
85
+ | --[no-]images | | Reduce HTML report size by excluding embedded images |
86
+ | -T, --title | TITLE | Report title |
87
+ | -I, --info | a:x,b:y,c:z | List of additional info about test - key:value |
88
+ | --css | STRING|PATH|URL | Additional CSS string or CSS file path or CSS file url for customizing html report |
89
+ | -h, --help | | Show available command line switches |
90
+ | -v, --version | | Show gem version |
85
91
 
86
92
  ### CLI Example:
87
93
 
data/bin/report_builder CHANGED
@@ -55,6 +55,14 @@ opt_parser = OptionParser.new do |opts|
55
55
  end
56
56
  end
57
57
 
58
+ opts.on('--css', 'Additional CSS string or CSS file path or CSS file url for customizing html report') do |additional_css|
59
+ options[:additional_css] = additional_css
60
+ end
61
+
62
+ opts.on('--js', 'Additional JS string or JS file path or JS file url for customizing html report') do |additional_js|
63
+ options[:additional_js] = additional_js
64
+ end
65
+
58
66
  opts.separator 'Common options:'
59
67
 
60
68
  opts.on_tail('-h', '--help', 'Show help') do
@@ -18,6 +18,7 @@ module ReportBuilder
18
18
 
19
19
  options[:report_types].map!(&:to_s).map!(&:upcase)
20
20
 
21
+ options[:json_path] ||= options[:input_path]
21
22
  files = get_files options[:json_path]
22
23
  raise "Error:: No file(s) found at #{options[:json_path]}" if files.empty?
23
24
 
@@ -28,6 +29,14 @@ module ReportBuilder
28
29
  file.write JSON.pretty_generate features
29
30
  end if options[:report_types].include? 'JSON'
30
31
 
32
+ if options[:additional_css] and Pathname.new(options[:additional_css]).file?
33
+ options[:additional_css] = File.read(options[:additional_css])
34
+ end
35
+
36
+ if options[:additional_js] and Pathname.new(options[:additional_js]).file?
37
+ options[:additional_js] = File.read(options[:additional_js])
38
+ end
39
+
31
40
  html_report_path = options[:html_report_path] || options[:report_path]
32
41
  File.open(html_report_path + '.html', 'w') do |file|
33
42
  file.write ERB.new(File.read(File.dirname(__FILE__) + '/../../template/html_report.erb')).result(binding).gsub(' ', '').gsub("\n\n", '')
@@ -192,10 +201,17 @@ module ReportBuilder
192
201
  total_time
193
202
  end
194
203
 
195
- def duration(seconds)
196
- seconds = seconds.to_f/1000000000
197
- m, s = seconds.divmod(60)
198
- "#{m}m #{'%.3f' % s}s"
204
+ def duration(ms)
205
+ s = ms.to_f/1000000000
206
+ m, s = s.divmod(60)
207
+ if m > 59
208
+ h, m = m.divmod(60)
209
+ "#{h}h #{m}m #{'%.2f' % s}s"
210
+ elsif m > 0
211
+ "#{m}m #{'%.2f' % s}s"
212
+ else
213
+ "#{'%.3f' % s}s"
214
+ end
199
215
  end
200
216
  end
201
217
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'report_builder'
3
- s.version = '1.2'
3
+ s.version = '1.3'
4
4
  s.bindir = 'bin'
5
5
  s.summary = 'ReportBuilder'
6
6
  s.description = 'Ruby gem to merge Cucumber JSON reports and build mobile friendly HTML Test Report, JSON report and retry file.'
@@ -7,15 +7,24 @@
7
7
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
8
8
  <link href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css" rel="stylesheet">
9
9
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css" media="screen,projection"/>
10
- <link href="https://cdn.rawgit.com/rajatthareja/ReportBuilder/770f5c65792926ef8318e95238ed0ef44addbec8/css/report.builder.min.css" rel="stylesheet">
10
+ <link href="https://cdn.rawgit.com/rajatthareja/ReportBuilder/v1.3/css/report.builder.min.css" rel="stylesheet">
11
11
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
12
+ <%if options[:additional_css]%>
13
+ <%if options[:additional_css] =~ /^http(|s):\/\/.*\.css$/%>
14
+ <link rel="stylesheet" href="<%=options[:additional_css]%>" media="all"/>
15
+ <%else%>
16
+ <style type="text/css">
17
+ <%= options[:additional_css]%>
18
+ </style>
19
+ <%end%>
20
+ <%end%>
12
21
  </head>
13
22
  <body>
14
23
 
15
24
  <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
16
- <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
17
- <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.0/Chart.min.js"></script>
18
- <script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
25
+ <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
26
+ <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.0/Chart.min.js"></script>
27
+ <script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
19
28
 
20
29
  <%errors = []%>
21
30
  <%features.each_with_index do |feature, f|%>
@@ -29,7 +38,7 @@
29
38
  <%end%>
30
39
  <%end%>
31
40
 
32
- <h5><%=scenario['name']%></h5>
41
+ <h5><%=scenario['name']%> (<%=duration(scenario['duration'])%>)</h5>
33
42
  <%=feature['uri']%>:<%=scenario['line']%>
34
43
 
35
44
  <%if scenario['before']%>
@@ -49,7 +58,7 @@
49
58
  <%end%>
50
59
 
51
60
  <ul class="collection stepList">
52
- <%scenario['steps'].each_with_index do |step|%>
61
+ <%scenario['steps'].each do |step|%>
53
62
  <li class="collection-item step <%=step['status']%>">
54
63
 
55
64
  <%if scenario['before']%>
@@ -68,22 +77,15 @@
68
77
  <%end%>
69
78
  <%end%>
70
79
 
71
- <b><%=step['keyword']%></b> <%=step['name']%>
80
+ <b><%=step['keyword']%></b> <%=step['name']%> (<%=duration(step['duration'])%>)
72
81
 
73
82
  <%if step['rows']%>
74
- <table>
75
- <tbody>
76
- <%step['rows'].each do |row|%>
77
- <tr>
78
- <td>|
79
- <%row['cells'].each do |cell|%>
80
- <%=cell + ' |'%>
81
- <%end%>
82
- </td>
83
- </tr>
83
+ <%step['rows'].each do |row|%>
84
+ <%='<br/>| '%>
85
+ <%row['cells'].each do |cell|%>
86
+ <%=cell + ' | '%>
84
87
  <%end%>
85
- </tbody>
86
- </table>
88
+ <%end%>
87
89
  <%end%>
88
90
 
89
91
  <%if step['output']%>
@@ -183,7 +185,7 @@
183
185
  </ul>
184
186
  </div>
185
187
  <div class="modal-footer">
186
- <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat"><i class="material-icons">close</i></a>
188
+ <span class="modal-action modal-close waves-effect waves-green btn-flat"><i class="material-icons">close</i></span>
187
189
  </div>
188
190
  </div>
189
191
  <%end%>
@@ -239,20 +241,20 @@
239
241
  </div>
240
242
  </div>
241
243
  </div>
242
- <div id="features" class="col s12 brown lighten-5">
244
+ <div id="features" class="col s12 brown lighten-5 white-text">
243
245
  <ul class="featureList collapsible popout" data-collapsible="expandable">
244
246
  <%features.each_with_index do |feature, f|%>
245
247
  <li class="feature <%=feature['status']%>">
246
- <div class="collapsible-header brown lighten-1 white-text waves-effect waves-light">
247
- <i class="material-icons white-text">featured_play_list</i>
248
- <b><%=feature['keyword']%></b>&nbsp;<%=feature['name']%>
248
+ <div class="collapsible-header brown lighten-1 waves-effect waves-light">
249
+ <i class="material-icons">featured_play_list</i>
250
+ <b><%=feature['keyword']%></b>&nbsp;<%=feature['name']%>&nbsp;(<%=duration(feature['duration'])%>)
249
251
  </div>
250
252
  <div class="collapsible-body brown lighten-4">
251
253
  <ul class="collection scenarioList">
252
254
  <%feature['elements'].each_with_index do |scenario, s|%>
253
255
  <li class="collection-item scenario <%=scenario['status']%>">
254
256
  <a class="waves-effect waves-light modal-trigger white-text" href="#f<%=f%>s<%=s%>">
255
- <b><%=scenario['keyword']%></b> <%=scenario['name']%>
257
+ <b><%=scenario['keyword']%></b> <%=scenario['name']%>&nbsp;(<%=duration(scenario['duration'])%>)
256
258
  </a>
257
259
  </li>
258
260
  <%end%>
@@ -266,8 +268,9 @@
266
268
  <table id="summaryTable" class="bordered brown lighten-1 white-text">
267
269
  <thead>
268
270
  <tr>
269
- <th>Feature</th>
271
+ <th class="hide-on-small-only">Feature</th>
270
272
  <th>Scenario</th>
273
+ <th class="hide">Tags</th>
271
274
  <th>Status</th>
272
275
  <th class="hide-on-small-only">Error</th>
273
276
  </tr>
@@ -276,10 +279,18 @@
276
279
  <%features.each_with_index do |feature, f|%>
277
280
  <%feature['elements'].each_with_index do |scenario, s|%>
278
281
  <tr class="<%=scenario['status']%>">
279
- <td class="hoverable"><%=feature['name']%></td>
282
+ <td class="hide-on-small-only"><%=feature['name']%></td>
280
283
  <td class="hoverable"><a class="modal-trigger white-text" href="#f<%=f%>s<%=s%>"><%=scenario['name']%></a></td>
281
- <td class="hoverable uppercase"><%=scenario['status']%></td>
282
- <td class="hoverable hide-on-small-only"><%if scenario['error']%><%=scenario['error']%><%end%></td>
284
+ <%# Scenarios Tags for search and filter %>
285
+ <td class="hide">
286
+ <%if scenario['tags']%>
287
+ <%scenario['tags'].each do |tag|%>
288
+ <%=tag['name'] + '. '%>
289
+ <%end%>
290
+ <%end%>
291
+ </td>
292
+ <td class="uppercase"><%=scenario['status']%></td>
293
+ <td class="hide-on-small-only"><%if scenario['error']%><%=scenario['error']%><%end%></td>
283
294
  </tr>
284
295
  <%end%>
285
296
  <%end%>
@@ -299,8 +310,8 @@
299
310
  <%feature['elements'].each_with_index do |scenario, s|%>
300
311
  <%if scenario['error']%>
301
312
  <%if scenario['error'] == error%>
302
- <li class="collection-item failedScenario brown lighten-5">
303
- <i class="material-icons red-text">highlight_off</i>&nbsp;<a class="modal-trigger red-text"href="#f<%=f%>s<%=s%>"><%=scenario['name']%></a>
313
+ <li class="collection-item failedScenario brown lighten-5 red-text">
314
+ <i class="material-icons">highlight_off</i>&nbsp;<a class="modal-trigger red-text"href="#f<%=f%>s<%=s%>"><%=scenario['name']%></a>
304
315
  </li>
305
316
  <%end%>
306
317
  <%end%>
@@ -324,13 +335,22 @@
324
335
  </div>
325
336
  </footer>
326
337
 
327
- <script>
338
+ <script type="text/javascript">
328
339
  $(document).ready(function () {
329
340
  <%features.each_with_index do |feature, f|%><%(0..feature['elements'].size).each do |s|%>
330
341
  $('#f<%=f%>s<%=s%>').modal();
331
342
  <%end%><%end%>
332
343
  });
333
344
  </script>
334
- <script src="https://cdn.rawgit.com/rajatthareja/ReportBuilder/770f5c65792926ef8318e95238ed0ef44addbec8/js/report.builder.min.js"></script>
345
+ <script type="text/javascript" src="https://cdn.rawgit.com/rajatthareja/ReportBuilder/v1.3/js/report.builder.min.js"></script>
346
+ <%if options[:additional_js]%>
347
+ <%if options[:additional_js] =~ /^http(|s):\/\/.*\.js$/%>
348
+ <script src="<%=options[:additional_js]%>"></script>
349
+ <%else%>
350
+ <script type="text/javascript">
351
+ <%= options[:additional_js]%>
352
+ </script>
353
+ <%end%>
354
+ <%end%>
335
355
  </body>
336
356
  </html>
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: '1.2'
4
+ version: '1.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajat Thareja
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-10 00:00:00.000000000 Z
11
+ date: 2017-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -61,6 +61,8 @@ extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
63
  - .gitignore
64
+ - .travis.yml
65
+ - CHANGELOG.md
64
66
  - Gemfile
65
67
  - LICENSE
66
68
  - README.md