Class: ReportBuilder::Builder
- Inherits:
-
Object
- Object
- ReportBuilder::Builder
- Defined in:
- lib/report_builder/builder.rb
Overview
ReportBuilder Main class
Instance Method Summary collapse
-
#build_report ⇒ Object
ReportBuilder Main method.
Instance Method Details
#build_report ⇒ Object
ReportBuilder Main method
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/report_builder/builder.rb', line 19 def build_report = ReportBuilder. groups = get_groups [:input_path] json_report_path = [:json_report_path] || [:report_path] if [:report_types].include? 'JSON' File.open(json_report_path + '.json', 'w') do |file| file.write JSON.pretty_generate(groups.size > 1 ? groups : groups.first['features']) end end if [:additional_css] and Pathname.new([:additional_css]).file? [:additional_css] = File.read([:additional_css]) end if [:additional_js] and Pathname.new([:additional_js]).file? [:additional_js] = File.read([:additional_js]) end html_report_path = [:html_report_path] || [:report_path] if [:report_types].include? 'HTML' File.open(html_report_path + '.html', 'w') do |file| file.write get(groups.size > 1 ? 'group_report' : 'report').result(binding) end end retry_report_path = [:retry_report_path] || [:report_path] if [:report_types].include? 'RETRY' File.open(retry_report_path + '.retry', 'w') do |file| groups.each do |group| group['features'].each do |feature| if feature['status'] == 'broken' feature['elements'].each do |scenario| file.puts "#{feature['uri']}:#{scenario['line']}" if scenario['status'] == 'failed' end end end end end end [json_report_path, html_report_path, retry_report_path] end |