module ReportBuilder

ReportBuilder Main module

Public Class Methods

additional_css() click to toggle source

Returns Report Builder additional CSS string or CSS file path or CSS file url for customizing html report

@return [String] additional_css additional CSS string or CSS file path or CSS file url for customizing html report

# File lib/report_builder.rb, line 351
def self.additional_css
  options[:additional_css]
end
additional_css=(additional_css) click to toggle source

Set Report Builder additional CSS string or CSS file path or CSS file url for customizing html report

@param [String] additional_css additional CSS string or CSS file path or CSS file url for customizing html report

Example:

ReportBuilder.additional_css = 'css/style.css'
# File lib/report_builder.rb, line 341
def self.additional_css=(additional_css)
  options
  @options[:additional_css] = additional_css if additional_css.is_a? String
end
additional_info() click to toggle source

Returns Report Builder additional info for report summary

@return [Hash] additional_info additional info for report summary

# File lib/report_builder.rb, line 236
def self.additional_info
  options[:additional_info]
end
additional_info=(additional_info) click to toggle source

Set Report Builder additional info for report summary

@param [Hash] additional_info additional info for report summary

Example:

ReportBuilder.additional_info = {'Environment' => 'Abc Environment', 'Browser' => 'Chrome'}
# File lib/report_builder.rb, line 226
def self.additional_info=(additional_info)
  options
  @options[:additional_info] = additional_info if additional_info.is_a? Hash
end
additional_js() click to toggle source

Returns Report Builder additional JS string or JS file path or JS file url for customizing html report

@return [String] additional_js additional JS string or JS file path or JS file url for customizing html report

# File lib/report_builder.rb, line 374
def self.additional_js
  options[:additional_js]
end
additional_js=(additional_js) click to toggle source

Set Report Builder additional JS string or JS file path or JS file url for customizing html report

@param [String] additional_js additional JS string or JS file path or JS file url for customizing html report

Example:

ReportBuilder.json_report_path = 'js/script.js'
# File lib/report_builder.rb, line 364
def self.additional_js=(additional_js)
  options
  @options[:additional_js=] = additional_js if additional_js.is_a? String
end
build_report(more_options = {}) click to toggle source

Build Report

@param [Hash] more_options override the default and configured options.

Example:

options = {
  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 options
# File lib/report_builder.rb, line 66
def self.build_report(more_options = {})
  options
  if more_options.is_a? String
    @options[:input_path] = more_options
  elsif more_options.is_a? Hash
    @options.merge! more_options
  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() click to toggle source

Returns Report Builder report color, Ex: indigo, cyan, purple, grey, lime etc.

@return [String] color report color, Ex: indigo, cyan, purple, grey, lime etc.

# File lib/report_builder.rb, line 397
def self.color
  options[:color]
end
color=(color) click to toggle source

Set Report Builder report color, Ex: indigo, cyan, purple, grey, lime etc.

@param [String] color report color, Ex: indigo, cyan, purple, grey, lime etc.

Example:

ReportBuilder.color = 'purple'
# File lib/report_builder.rb, line 387
def self.color=(color)
  options
  @options[:color] = color if color.is_a? String
end
configure() { |more_options| ... } click to toggle source

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
# File lib/report_builder.rb, line 39
def self.configure
  options
  more_options = OpenStruct.new
  yield more_options if block_given?
  @options.merge! more_options.marshal_dump
end
html_report_path() click to toggle source

Returns Report Builder html report output file path with file name without extension

@return [String] html_report_path html report output file path with file name without extension

# File lib/report_builder.rb, line 305
def self.html_report_path
  options[:html_report_path] || options[:report_path]
end
html_report_path=(html_report_path) click to toggle source

Set Report Builder html report output file path with file name without extension

@param [String] html_report_path html report output file path with file name without extension

Example:

ReportBuilder.html_report_path = 'reports/report'
# File lib/report_builder.rb, line 295
def self.html_report_path=(html_report_path)
  options
  @options[:html_report_path] = html_report_path if html_report_path.is_a? String
end
include_images() click to toggle source

Returns Report Builder include or excluding embedded images

@return [Boolean] include_images include or excluding embedded images

# File lib/report_builder.rb, line 190
def self.include_images
  options[:include_images]
end
include_images=(include_images) click to toggle source

Set Report Builder include or excluding embedded images

@param [Boolean] include_images include or excluding embedded images

Example:

ReportBuilder.include_images = false
# File lib/report_builder.rb, line 180
def self.include_images=(include_images)
  options
  @options[:include_images] = include_images if !!include_images == include_images
end
input_path() click to toggle source

Returns Report Builder input json files path / array of json files or path / hash of json files or path

@return [String/Array/Hash] input_path input json files path / array of json files or path / hash of json files or path

# File lib/report_builder.rb, line 121
def self.input_path
  options[:input_path]
end
input_path=(input_path) click to toggle source

Set Report Builder input json files path / array of json files or path / hash of json files or path

@param [String/Array/Hash] input_path input json files path / array of json files or path / hash of json files or path

Example:

ReportBuilder.input_path = 'my_project/cucumber_json'
# File lib/report_builder.rb, line 111
def self.input_path=(input_path)
  options
  @options[:input_path] = input_path
end
json_path() click to toggle source

Returns Report Builder input json files path / array of json files or path / hash of json files or path

@return [String/Array/Hash] json_path input json files path / array of json files or path / hash of json files or path

# File lib/report_builder.rb, line 98
def self.json_path
  options[:input_path]
end
json_path=(json_path) click to toggle source

Set Report Builder input json files path / array of json files or path / hash of json files or path

@param [String/Array/Hash] json_path input json files path / array of json files or path / hash of json files or path

Example:

ReportBuilder.json_path = 'my_project/cucumber_json'
# File lib/report_builder.rb, line 88
def self.json_path=(json_path)
  options
  @options[:input_path] = json_path
end
json_report_path() click to toggle source

Returns Report Builder json report output file path with file name without extension

@return [String] json_report_path json report output file path with file name without extension

# File lib/report_builder.rb, line 282
def self.json_report_path
  options[:json_report_path] || options[:report_path]
end
json_report_path=(json_report_path) click to toggle source

Set Report Builder json report output file path with file name without extension

@param [String] json_report_path json report output file path with file name without extension

Example:

ReportBuilder.json_report_path = 'reports/report'
# File lib/report_builder.rb, line 272
def self.json_report_path=(json_report_path)
  options
  @options[:json_report_path] = json_report_path if json_report_path.is_a? String
end
options() click to toggle source

ReportBuilder options

# File lib/report_builder.rb, line 11
def self.options
  @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() click to toggle source

Returns Report Builder reports output file path with file name without extension

@return [String] report_path reports output file path with file name without extension

# File lib/report_builder.rb, line 259
def self.report_path
  options[:report_path]
end
report_path=(report_path) click to toggle source

Set Report Builder reports output file path with file name without extension

@param [String] report_path reports output file path with file name without extension

Example:

ReportBuilder.report_path = 'reports/report'
# File lib/report_builder.rb, line 249
def self.report_path=(report_path)
  options
  options[:report_path] = report_path if report_path.is_a? String
end
report_title() click to toggle source

Returns Report Builder HTML report title

@return [String] report_title HTML report title

# File lib/report_builder.rb, line 167
def self.report_title
  options[:report_title]
end
report_title=(report_title) click to toggle source

Set Report Builder HTML report title

@param [String] report_title HTML report title

Example:

ReportBuilder.report_title = 'My Report'
# File lib/report_builder.rb, line 157
def self.report_title=(report_title)
  options
  @options[:report_title] = report_title if report_title.is_a? String
end
report_types() click to toggle source

Returns Report Builder report_types :json, :html, :retry (output file types)

@return [Array] report_types :json, :html, :retry (output file types)

# File lib/report_builder.rb, line 144
def self.report_types
  options[:report_types]
end
report_types=(report_types) click to toggle source

Set Report Builder report_types :json, :html, :retry (output file types)

@param [Array] report_types :json, :html, :retry (output file types)

Example:

ReportBuilder.report_types = [:html, :retry]
# File lib/report_builder.rb, line 134
def self.report_types=(report_types)
  options
  @options[:report_types] = report_types.is_a? Array ? report_types : [report_types]
end
retry_report_path() click to toggle source

Returns Report Builder retry report output file path with file name without extension

@return [String] retry_report_path retry report output file path with file name without extension

# File lib/report_builder.rb, line 328
def self.retry_report_path
  options[:retry_report_path] || options[:report_path]
end
retry_report_path=(retry_report_path) click to toggle source

Set Report Builder retry report output file path with file name without extension

@param [String] retry_report_path retry report output file path with file name without extension

Example:

ReportBuilder.retry_report_path = 'reports/report'
# File lib/report_builder.rb, line 318
def self.retry_report_path=(retry_report_path)
  options
  @options[:retry_report_path] = retry_report_path if retry_report_path.is_a? String
end
set(option, value) click to toggle source

Set Report Builder Options

@param [String] option @param [String] value

Example:

ReportBuilder.set('title', 'My Features')
# File lib/report_builder.rb, line 426
def self.set(option, value)
  set_option(option, value)
end
set_option(option, value) click to toggle source

Set Report Builder Options

@param [String] option @param [String] value

Example:

ReportBuilder.set('title', 'My Features')
# File lib/report_builder.rb, line 411
def self.set_option(option, value)
  options
  @options[option.to_sym] = value
end
voice_commands() click to toggle source

Returns Report Builder enable or disable voice commands

@return [Boolean] voice_commands enable or disable voice commands

# File lib/report_builder.rb, line 213
def self.voice_commands
  options[:voice_commands]
end
voice_commands=(voice_commands) click to toggle source

Set Report Builder enable or disable voice commands

@param [Boolean] voice_commands enable or disable voice commands

Example:

ReportBuilder.voice_commands = true
# File lib/report_builder.rb, line 203
def self.voice_commands=(voice_commands)
  options
  @options[:voice_commands] = voice_commands if !!voice_commands == voice_commands
end