rajatthareja / ReportBuilder

Ruby gem to merge Cucumber JSON reports and build mobile-friendly HTML Test Report, JSON report and retry file.
https://reportbuilder.rajatthareja.com
MIT License
81 stars 47 forks source link

Encoding Issue #77

Closed serhatbolsu closed 5 years ago

serhatbolsu commented 5 years ago

Hi, While generating json report, I get an encode error.

Traceback (most recent call last):
    8: from /Users/serhat/repos/pf-quality/pf-website/features/support/hooks.rb:73:in `block in <top (required)>'
    7: from /Users/serhat/repos/pf-quality/pf-website/features/support/driver_config.rb:227:in `consolidated_report'
    6: from /Users/serhat/.rvm/gems/ruby-2.5.1/gems/report_builder-1.7/lib/report_builder.rb:76:in `build_report'
    5: from /Users/serhat/.rvm/gems/ruby-2.5.1/gems/report_builder-1.7/lib/report_builder/builder.rb:26:in `build_report'
    4: from /Users/serhat/.rvm/gems/ruby-2.5.1/gems/report_builder-1.7/lib/report_builder/builder.rb:26:in `open'
    3: from /Users/serhat/.rvm/gems/ruby-2.5.1/gems/report_builder-1.7/lib/report_builder/builder.rb:27:in `block in build_report'
    2: from /Users/serhat/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/json/common.rb:286:in `pretty_generate'
    1: from /Users/serhat/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/json/common.rb:286:in `generate'
/Users/serhat/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/json/common.rb:286:in `encode': "\x89" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)

Script that I used to generate:

  ReportBuilder.input_path = "tmp/#{ENV['COUNTRY']}/parallel/"
  ReportBuilder.configure do |config|
    config.report_path = "reports/#{ENV['COUNTRY']}_run"
    config.report_types = [:json]
  end
  options = {
      report_title: "Property Finder's #{ENV['COUNTRY'].upcase} consolidated Website report #{ENV['REPORT']}"
  }
  ReportBuilder.build_report options

Also you can get the file that was failing from here https://drive.google.com/open?id=1Wt9y3AHBXbpuoYMQxNscYoOuQQ10YSPf

serhatbolsu commented 5 years ago

@rajatthareja did you had the chance to check, I have given access to json file

chhatbarjignesh commented 5 years ago

Hi @serhatbolsu

I tried with your json files and i am able to generate the report successfully

image

only thing i see in your script is why are you using the config.report_types = [:json] ? try changing it to config.report_types = [:html]

i think the report_types says what you want as output not the input so if you change it to html it will work

serhatbolsu commented 5 years ago

Closing for now, I will re-open when I have evidance