Module: ReportBuilder
- Defined in:
- lib/report_builder.rb,
lib/report_builder/builder.rb
Overview
ReportBuilder Main module
Defined Under Namespace
Classes: Builder
Class Method Summary collapse
-
.additional_css ⇒ String
Returns Report Builder additional CSS string or CSS file path or CSS file url for customizing html report.
-
.additional_css=(additional_css) ⇒ Object
Set Report Builder additional CSS string or CSS file path or CSS file url for customizing html report.
-
.additional_info ⇒ Hash
Returns Report Builder additional info for report summary.
-
.additional_info=(additional_info) ⇒ Object
Set Report Builder additional info for report summary.
-
.additional_js ⇒ String
Returns Report Builder additional JS string or JS file path or JS file url for customizing html report.
-
.additional_js=(additional_js) ⇒ Object
Set Report Builder additional JS string or JS file path or JS file url for customizing html report.
-
.build_report(more_options = {}) ⇒ Object
Build Report.
-
.color ⇒ String
Returns Report Builder report color, Ex: indigo, cyan, purple, grey, lime etc.
-
.color=(color) ⇒ Object
Set Report Builder report color, Ex: indigo, cyan, purple, grey, lime etc.
-
.configure {|more_options| ... } ⇒ Object
Configure ReportBuilder.
-
.html_report_path ⇒ String
Returns Report Builder html report output file path with file name without extension.
-
.html_report_path=(html_report_path) ⇒ Object
Set Report Builder html report output file path with file name without extension.
-
.include_images ⇒ Boolean
Returns Report Builder include or excluding embedded images.
-
.include_images=(include_images) ⇒ Object
Set Report Builder include or excluding embedded images.
-
.input_path ⇒ String/Array/Hash
Returns Report Builder input json files path / array of json files or path / hash of json files or path.
-
.input_path=(input_path) ⇒ Object
Set Report Builder input json files path / array of json files or path / hash of json files or path.
-
.json_path ⇒ String/Array/Hash
Returns Report Builder input json files path / array of json files or path / hash of json files or path.
-
.json_path=(json_path) ⇒ Object
Set Report Builder input json files path / array of json files or path / hash of json files or path.
-
.json_report_path ⇒ String
Returns Report Builder json report output file path with file name without extension.
-
.json_report_path=(json_report_path) ⇒ Object
Set Report Builder json report output file path with file name without extension.
-
.options ⇒ Object
ReportBuilder options.
-
.report_path ⇒ String
Returns Report Builder reports output file path with file name without extension.
-
.report_path=(report_path) ⇒ Object
Set Report Builder reports output file path with file name without extension.
-
.report_title ⇒ String
Returns Report Builder HTML report title.
-
.report_title=(report_title) ⇒ Object
Set Report Builder HTML report title.
-
.report_types ⇒ Array
Returns Report Builder report_types :json, :html, :retry (output file types).
-
.report_types=(report_types) ⇒ Object
Set Report Builder report_types :json, :html, :retry (output file types).
-
.retry_report_path ⇒ String
Returns Report Builder retry report output file path with file name without extension.
-
.retry_report_path=(retry_report_path) ⇒ Object
Set Report Builder retry report output file path with file name without extension.
-
.set(option, value) ⇒ Object
Set Report Builder Options.
-
.set_option(option, value) ⇒ Object
Set Report Builder Options.
-
.voice_commands ⇒ Boolean
Returns Report Builder enable or disable voice commands.
-
.voice_commands=(voice_commands) ⇒ Object
Set Report Builder enable or disable voice commands.
Class Method Details
.additional_css ⇒ String
Returns Report Builder additional CSS string or CSS file path or CSS file url for customizing html report
351 352 353 |
# File 'lib/report_builder.rb', line 351 def self.additional_css [:additional_css] end |
.additional_css=(additional_css) ⇒ Object
Set Report Builder additional CSS string or CSS file path or CSS file url for customizing html report
Example:
ReportBuilder.additional_css = 'css/style.css'
341 342 343 344 |
# File 'lib/report_builder.rb', line 341 def self.additional_css=(additional_css) @options[:additional_css] = additional_css if additional_css.is_a? String end |
.additional_info ⇒ Hash
Returns Report Builder additional info for report summary
236 237 238 |
# File 'lib/report_builder.rb', line 236 def self.additional_info [:additional_info] end |
.additional_info=(additional_info) ⇒ Object
Set Report Builder additional info for report summary
Example:
ReportBuilder.additional_info = {'Environment' => 'Abc Environment', 'Browser' => 'Chrome'}
226 227 228 229 |
# File 'lib/report_builder.rb', line 226 def self.additional_info=(additional_info) @options[:additional_info] = additional_info if additional_info.is_a? Hash end |
.additional_js ⇒ String
Returns Report Builder additional JS string or JS file path or JS file url for customizing html report
374 375 376 |
# File 'lib/report_builder.rb', line 374 def self.additional_js [:additional_js] end |
.additional_js=(additional_js) ⇒ Object
Set Report Builder additional JS string or JS file path or JS file url for customizing html report
Example:
ReportBuilder.json_report_path = 'js/script.js'
364 365 366 367 |
# File 'lib/report_builder.rb', line 364 def self.additional_js=(additional_js) @options[:additional_js=] = additional_js if additional_js.is_a? String end |
.build_report(more_options = {}) ⇒ Object
Build Report
Example:
= {
json_path: 'cucumber_sample/logs',
report_path: 'my_test_report',
report_types: ['retry', 'html'],
report_title: 'My Test Results',
include_images: true,
voice_commands: true,
color: 'deep-purple',
additional_info: {'browser' => 'Chrome', 'environment' => 'Stage 5'}
}
ReportBuilder.build_report
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/report_builder.rb', line 66 def self.build_report( = {}) if .is_a? String @options[:input_path] = elsif .is_a? Hash @options.merge! end @options[:input_path] = @options[:json_path] if @options[:json_path] @options[:report_types] = [@options[:report_types]] unless @options[:report_types].is_a? Array @options[:report_types].map!(&:to_s).map!(&:upcase) Builder.new.build_report end |
.color ⇒ String
Returns Report Builder report color, Ex: indigo, cyan, purple, grey, lime etc.
397 398 399 |
# File 'lib/report_builder.rb', line 397 def self.color [:color] end |
.color=(color) ⇒ Object
Set Report Builder report color, Ex: indigo, cyan, purple, grey, lime etc.
Example:
ReportBuilder.color = 'purple'
387 388 389 390 |
# File 'lib/report_builder.rb', line 387 def self.color=(color) @options[:color] = color if color.is_a? String end |
.configure {|more_options| ... } ⇒ Object
Configure ReportBuilder
Example:
ReportBuilder.configure do |config|
config.input_path = 'cucumber_sample/logs'
config.report_path = 'my_test_report'
config.report_types = [:RETRY, :HTML]
config.report_title = 'My Test Results'
config.include_images = true
config.voice_commands = true
config.additional_info = {Browser: 'Chrome', Environment: 'Stage 5'}
end
39 40 41 42 43 44 |
# File 'lib/report_builder.rb', line 39 def self.configure = OpenStruct.new yield if block_given? @options.merge! .marshal_dump end |
.html_report_path ⇒ String
Returns Report Builder html report output file path with file name without extension
305 306 307 |
# File 'lib/report_builder.rb', line 305 def self.html_report_path [:html_report_path] || [:report_path] end |
.html_report_path=(html_report_path) ⇒ Object
Set Report Builder html report output file path with file name without extension
Example:
ReportBuilder.html_report_path = 'reports/report'
295 296 297 298 |
# File 'lib/report_builder.rb', line 295 def self.html_report_path=(html_report_path) @options[:html_report_path] = html_report_path if html_report_path.is_a? String end |
.include_images ⇒ Boolean
Returns Report Builder include or excluding embedded images
190 191 192 |
# File 'lib/report_builder.rb', line 190 def self.include_images [:include_images] end |
.include_images=(include_images) ⇒ Object
Set Report Builder include or excluding embedded images
Example:
ReportBuilder.include_images = false
180 181 182 183 |
# File 'lib/report_builder.rb', line 180 def self.include_images=(include_images) @options[:include_images] = include_images if !!include_images == include_images end |
.input_path ⇒ String/Array/Hash
Returns Report Builder input json files path / array of json files or path / hash of json files or path
121 122 123 |
# File 'lib/report_builder.rb', line 121 def self.input_path [:input_path] end |
.input_path=(input_path) ⇒ Object
Set Report Builder input json files path / array of json files or path / hash of json files or path
Example:
ReportBuilder.input_path = 'my_project/cucumber_json'
111 112 113 114 |
# File 'lib/report_builder.rb', line 111 def self.input_path=(input_path) @options[:input_path] = input_path end |
.json_path ⇒ String/Array/Hash
Returns Report Builder input json files path / array of json files or path / hash of json files or path
98 99 100 |
# File 'lib/report_builder.rb', line 98 def self.json_path [:input_path] end |
.json_path=(json_path) ⇒ Object
Set Report Builder input json files path / array of json files or path / hash of json files or path
Example:
ReportBuilder.json_path = 'my_project/cucumber_json'
88 89 90 91 |
# File 'lib/report_builder.rb', line 88 def self.json_path=(json_path) @options[:input_path] = json_path end |
.json_report_path ⇒ String
Returns Report Builder json report output file path with file name without extension
282 283 284 |
# File 'lib/report_builder.rb', line 282 def self.json_report_path [:json_report_path] || [:report_path] end |
.json_report_path=(json_report_path) ⇒ Object
Set Report Builder json report output file path with file name without extension
Example:
ReportBuilder.json_report_path = 'reports/report'
272 273 274 275 |
# File 'lib/report_builder.rb', line 272 def self.json_report_path=(json_report_path) @options[:json_report_path] = json_report_path if json_report_path.is_a? String end |
.options ⇒ Object
ReportBuilder options
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/report_builder.rb', line 11 def self. @options ||= { input_path: Dir.pwd, report_types: [:html], report_title: 'Test Results', include_images: true, voice_commands: false, additional_info: {}, report_path: 'test_report', color: 'brown' } end |
.report_path ⇒ String
Returns Report Builder reports output file path with file name without extension
259 260 261 |
# File 'lib/report_builder.rb', line 259 def self.report_path [:report_path] end |
.report_path=(report_path) ⇒ Object
Set Report Builder reports output file path with file name without extension
Example:
ReportBuilder.report_path = 'reports/report'
249 250 251 252 |
# File 'lib/report_builder.rb', line 249 def self.report_path=(report_path) [:report_path] = report_path if report_path.is_a? String end |
.report_title ⇒ String
Returns Report Builder HTML report title
167 168 169 |
# File 'lib/report_builder.rb', line 167 def self.report_title [:report_title] end |
.report_title=(report_title) ⇒ Object
157 158 159 160 |
# File 'lib/report_builder.rb', line 157 def self.report_title=(report_title) @options[:report_title] = report_title if report_title.is_a? String end |
.report_types ⇒ Array
Returns Report Builder report_types :json, :html, :retry (output file types)
144 145 146 |
# File 'lib/report_builder.rb', line 144 def self.report_types [:report_types] end |
.report_types=(report_types) ⇒ Object
Set Report Builder report_types :json, :html, :retry (output file types)
Example:
ReportBuilder.report_types = [:html, :retry]
134 135 136 137 |
# File 'lib/report_builder.rb', line 134 def self.report_types=(report_types) @options[:report_types] = report_types.is_a? Array ? report_types : [report_types] end |
.retry_report_path ⇒ String
Returns Report Builder retry report output file path with file name without extension
328 329 330 |
# File 'lib/report_builder.rb', line 328 def self.retry_report_path [:retry_report_path] || [:report_path] end |
.retry_report_path=(retry_report_path) ⇒ Object
Set Report Builder retry report output file path with file name without extension
Example:
ReportBuilder.retry_report_path = 'reports/report'
318 319 320 321 |
# File 'lib/report_builder.rb', line 318 def self.retry_report_path=(retry_report_path) @options[:retry_report_path] = retry_report_path if retry_report_path.is_a? String end |
.set(option, value) ⇒ Object
426 427 428 |
# File 'lib/report_builder.rb', line 426 def self.set(option, value) set_option(option, value) end |
.set_option(option, value) ⇒ Object
411 412 413 414 |
# File 'lib/report_builder.rb', line 411 def self.set_option(option, value) @options[option.to_sym] = value end |
.voice_commands ⇒ Boolean
Returns Report Builder enable or disable voice commands
213 214 215 |
# File 'lib/report_builder.rb', line 213 def self.voice_commands [:voice_commands] end |
.voice_commands=(voice_commands) ⇒ Object
203 204 205 206 |
# File 'lib/report_builder.rb', line 203 def self.voice_commands=(voice_commands) @options[:voice_commands] = voice_commands if !!voice_commands == voice_commands end |