Coder Social home page Coder Social logo

rajatthareja / reportbuilder Goto Github PK

View Code? Open in Web Editor NEW
81.0 81.0 47.0 15.03 MB

Ruby gem to merge Cucumber JSON reports and build mobile-friendly HTML Test Report, JSON report and retry file.

Home Page: https://reportbuilder.rajatthareja.com

License: MIT License

Ruby 18.71% HTML 74.41% CSS 0.22% JavaScript 6.66%
cucumber-reports rubygem

reportbuilder's People

Contributors

cheezy avatar chhatbarjignesh avatar colintsteele avatar drkcloudstrife avatar enkessler avatar gitter-badger avatar jflohre avatar kramarol avatar mascolim avatar phebus avatar rajatthareja avatar rangiferus avatar ryderstorm avatar sjohnson55110 avatar sofiawan avatar thiagotrentin avatar tk8817 avatar wiro34 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reportbuilder's Issues

Issue with html report generation after feature run

I am facing issue with the html report generation. I have configured my application as per the steps specified on ReadMe.
Following is my configuration - created create_sample_reports.rb and placed in features/support folder

require 'report_builder'
ReportBuilder.configure do |config|
config.json_path = 'features/reports'
config.report_path = 'features/reports/report'
config.report_types = [:json, :html]
config.report_title = 'AK_Results'
config.additional_info = {Browser: 'browser', Environment: 'environment', MoreInfo: 'more info'}
end
ReportBuilder.build_report

The generated report.json is correct; however the report.html does not refer the latest json data.
Any help is appreciated.

Access to un-minified CSS for use in development

Hey @rajatthareja , I am working on cleaning up the HTML report styling but it is tough with the minified-css. Any chance you can provide me with the full css files.

I have an completed feature branch for one main item (styling H3's instead of spans), but will need the css files to move span broken/passed styling to h3 , and remove existing H3 styles.

Here is a screenshot of what it looks likes when it is fully working (I injected the CSS live in chrome, based on the styles generated in my feature branch)

New H3 Styling

Passing all Json from different folder

IS it possible to enhance report builder based on folder and create dashboard accordingly.

For eg:

If i have function a -which has 3 json
Functionality b- which has 3 json

Can i get master dashboard with functionality and no.of test than at feature level

issues with fixnum

I met this issues when try to run the report builder

NoMethodError: undefined method `gsub' for 1:Fixnum

seems there's some fixnum in output string block the process

after i add a '.to_s' to line328 at report_builder.rb

def self.build_output(outputs)
outputs.each do |output|
@builder << "#{output.to_s.gsub("\n",'
').gsub("\t",'  ').gsub(' ',' ')}

"
end if outputs.is_a?(Array)
end

it works fine

how can i save this change on my own project

Building HTML report fails when encountering output as Hash

My JSON reports are slightly different from "typical" in that I add some additional information to them (via hooks). This information is added as a Hash (e.g. puts [x:1, y:2]) and the JSON formatter understands that just fine. Any post-processing of the JSON I do is merely augmented by this data and the default HTML formatter seems to handle it without issues, as well.

The report_builder script, however, appears to expect output added via puts to be text, and therefore chokes on a failed attempt to .gsub(...). Not a big deal; I added an "unless output.is_a? Hash" for now because I don't care about that content being in the HTML report anyway. Any thoughts around what the preferred approach should be?

/Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:330:in `block in build_output': undefined method `gsub' for #<Hash:0x007fed5d170640> (NoMethodError)
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:329:in `each'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:329:in `build_output'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:294:in `block (2 levels) in build_scenario'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:293:in `each'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:293:in `block in build_scenario'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:190:in `block (2 levels) in cache_method_call'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:286:in `build_scenario'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:206:in `block (8 levels) in build_report'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:206:in `each'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:206:in `block (7 levels) in build_report'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:190:in `block (2 levels) in cache_method_call'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:205:in `block (6 levels) in build_report'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:190:in `block (2 levels) in cache_method_call'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:204:in `block (5 levels) in build_report'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:198:in `each'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:198:in `each_with_index'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:198:in `block (4 levels) in build_report'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:190:in `block (2 levels) in cache_method_call'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:197:in `block (3 levels) in build_report'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:190:in `block (2 levels) in cache_method_call'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:195:in `block (2 levels) in build_report'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/builder-3.2.2/lib/builder/xmlbase.rb:190:in `block (2 levels) in cache_method_call'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:186:in `block in build_report'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:115:in `open'
    from /Users/dsharkov/.rvm/gems/ruby-2.0.0-p643/gems/report_builder-0.1.2/lib/report_builder.rb:115:in `build_report'
    from scripts/report_builder.rb:12:in `<main>'

Unable to activate report_builder-0.1.2, because json-2.0.2 conflicts with json (>= 1.8.1, ~> 1.8) (Gem::ConflictError)

I just don't understand why I would get an error like this. I created a project (on GitHub) that runs tests in parallel , wrapped by Rake+bundler BUT when I try to run my project with just raw/bare cucumber, this is what I get...
I'm on Ubuntu 16.10.

superu@osboxes:~/Workspace/cuke-parallel-starter$ cucumber features --format progress
Unable to activate report_builder-0.1.2, because json-2.0.2 conflicts with json (>= 1.8.1, ~> 1.8) (Gem::ConflictError)
/home/superu/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/specification.rb:2288:in `raise_if_conflicts'
/home/superu/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/specification.rb:1408:in `activate'
/home/superu/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems.rb:220:in `rescue in try_activate'
/home/superu/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems.rb:213:in `try_activate'
/home/superu/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:126:in `rescue in require'
/home/superu/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:40:in `require'
/home/superu/Workspace/cuke-parallel-starter/features/support/env.rb:4:in `<top (required)>'
/home/superu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/rb_support/rb_language.rb:96:in `load'
/home/superu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/rb_support/rb_language.rb:96:in `load_code_file'
/home/superu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:142:in `load_file'
/home/superu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:84:in `block in load_files!'
/home/superu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:83:in `each'
/home/superu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:83:in `load_files!'
/home/superu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime.rb:253:in `load_step_definitions'
/home/superu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/runtime.rb:61:in `run!'
/home/superu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/cli/main.rb:32:in `execute!'
/home/superu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/bin/cucumber:8:in `<top (required)>'
/home/superu/.rbenv/versions/2.4.0/bin/cucumber:22:in `load'
/home/superu/.rbenv/versions/2.4.0/bin/cucumber:22:in `<main>'
superu@osboxes:~/Workspace/cuke-parallel-starter$ bundler exec cucumber -r features --format progress
Exception `NameError' at /home/superu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cucumber-2.4.0/lib/cucumber/constantize.rb:41 - uninitialized constant Cucumber::Formatter::Progress
Did you mean?  Process
.
Slept for 0.11357592786443138 milliseconds.
..
Slept for 0.18566912861453533 milliseconds.
..

Imposible to parse when json has only one element

I have the following json:

[
  {
    "uri": "features/companies/my_staff/employees.feature",
    "id": "employees-in-companies-my-staff",
    "keyword": "Feature",
    "name": "Employees in Companies My Staff",
    "description": "",
    "line": 5,
    "tags": [
      {
        "name": "@companies",
        "line": 1
      },
      {
        "name": "@my_staff",
        "line": 2
      },
      {
        "name": "@android",
        "line": 3
      },
      {
        "name": "@ios",
        "line": 4
      }
    ],
    "elements": [
      {
        "keyword": "Background",
        "name": "",
        "description": "",
        "line": 7,
        "type": "background",
        "before": [
          {
            "match": {
              "location": "requires/req_appium.rb:52"
            },
            "result": {
              "status": "passed",
              "duration": 5591021000
            }
          }
        ],
        "steps": [
          {
            "keyword": "Given ",
            "name": "I am logged as a valid company",
            "line": 8,
            "match": {
              "location": "features/step_definitions/companies/company_login_steps.rb:74"
            },
            "result": {
              "status": "passed",
              "duration": 22736316000
            }
          },
          {
            "keyword": "And ",
            "name": "I go to my staff",
            "line": 9,
            "match": {
              "location": "features/step_definitions/companies/company_tab_bar_steps.rb:13"
            },
            "result": {
              "status": "passed",
              "duration": 1494416000
            }
          },
          {
            "keyword": "And ",
            "name": "I go to companies employees",
            "line": 10,
            "match": {
              "location": "features/step_definitions/companies/company_employees_steps.rb:1"
            },
            "result": {
              "status": "passed",
              "duration": 3287514000
            }
          }
        ],
        "after": [
          {
            "match": {
              "location": "requires/req_appium.rb:66"
            },
            "result": {
              "status": "passed",
              "duration": 3785347000
            }
          }
        ]
      }
    ]
  }
] 

and it 's failing in line 543:

feature['elements'][i+1]['steps'] = feature['elements'][i]['steps'] + feature['elements'][i+1]['steps']

feature['elements'][i+1] is nil

because only exits one "element" on elements array.

Any idea?

Cannot get it to work

Hello, first of all, very nice plugin!!

I just can't get it to work. I'm trying to use it in order to have all the different reports inside the same file generated using the parallel_cucumber plugin.

For some reason, when executing it:

report_builder -s "reports/123/report-1.json,reports/123/report-2.json" -f html

I'm getting this error and I can't understand what is that about:

/var/lib/gems/2.2.0/gems/report_builder-0.1.2/lib/report_builder.rb:100:in `rescue in build_report': ReportBuilderParsingError (RuntimeError)
    from /var/lib/gems/2.2.0/gems/report_builder-0.1.2/lib/report_builder.rb:100:in `build_report'
    from /var/lib/gems/2.2.0/gems/report_builder-0.1.2/bin/report_builder:66:in `<top (required)>'
    from /usr/local/bin/report_builder:23:in `load'
    from /usr/local/bin/report_builder:23:in `<main>'

Do you know what could be causing this issue?

Thanks!

additional_js evaluates to true and not path

When trying to use the Additional JS option with --js in command line, I am given the error message no implicit conversion of true to String. After placing a binding inside of the bin/report_builder it seems apparent that the block arguments given to any of the additional options are true if an option flag is given in the CLI, but no actual value is being passed in.

If tags are added at the example levels for scenario outline, then those examples are not reported in the html report

If tags are added at the example levels for scenario outline, then those examples are not reported in the html report

@tag1
 Scenario Outline: Breaker joins a game
 Given the Maker has started a game with the word "<word>"
 When the Breaker joins the Maker's game
 Then the Breaker must guess a word with 5 characters

 @smoke @qa_only
 Examples:
   | word     |
   | silky    |
Examples:
   | word     |
   | second   |
   | third    |

if you run the above scenario and generate the report it will generate only three scenario in report and from that three it will say two are duplicate with (X2) added in scenario description

Encoding Compatibility Error

I'm trying to build the final report, but I got this error:

$bundle exec report_builder -s "${SAVE_PATH}" -o "${SAVE_PATH}/final_report_`$ts`"
Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT
  (erb):169:in `concat'
  (erb):169:in `block (5 levels) in build_report'
  (erb):166:in `each'
  (erb):166:in `block (4 levels) in build_report'
  (erb):153:in `each'
  (erb):153:in `block (3 levels) in build_report'
  (erb):22:in `each'
  (erb):22:in `each_with_index'
  (erb):22:in `block (2 levels) in build_report'
  (erb):21:in `each'
  (erb):21:in `each_with_index'
  (erb):21:in `block in build_report'
  /usr/local/lib/ruby/2.4.0/erb.rb:896:in `eval'
  /usr/local/lib/ruby/2.4.0/erb.rb:896:in `result'
  /usr/local/bundle/gems/report_builder-1.2/lib/report_builder/builder.rb:33:in `block in build_report'
  /usr/local/bundle/gems/report_builder-1.2/lib/report_builder/builder.rb:32:in `open'
  /usr/local/bundle/gems/report_builder-1.2/lib/report_builder/builder.rb:32:in `build_report'
  /usr/local/bundle/gems/report_builder-1.2/lib/report_builder.rb:45:in `build_report'
  /usr/local/bundle/gems/report_builder-1.2/bin/report_builder:73:in `<top (required)>'
  /usr/local/bundle/bin/report_builder:23:in `load'
  /usr/local/bundle/bin/report_builder:23:in `<top (required)>'
bundler: failed to load command: report_builder (/usr/local/bundle/bin/report_builder)

Added section for filtering Tags on Summary page.

Is there already a way to create a section like below?
image

We have scenarios that have certain tags(that start with acauto_) that we would like to show up in the report. I found out how to do this and was thinking about making a pull request for this. Basically passing in an option and if that option is true to show the column and if a filter is provided than filter that tags.

Is this possible already?

Thank you

Support for DataTables (fix coming in Cucumber 2.3.3+ )

Hey @rajatthareja,

The cucumber dev's just closed a ticket of mine where inline data tables were not being sent to the JSON report. This was broken since Cucumber 2.1. The have pushed a fix to master, but not yet released.

To fully understand the matter, please see my ticket here: cucumber/cucumber-ruby#948

Once the fix is released we should be prepared to correctly handle/display this new data in the HTML report.

Retry file created '.retry' format

My config in hooks.rb
config.retry_report_path = 'tmp/retry'
config.report_types = [:html, :retry]

String from readme for config

json report output file path with file name without extension

After finishing tests I have file 'retry.retry', but i need '.txt' file for cucumber

Total time is incorrect in context of parallel runs.

Hey,
this might be a tough bug to fix but I noticed that the report combines all of the individual runtimes, this is only correct if you are running sequentially. I imagine this gem is most useful for parallel runs so it would be cool if you could check the earliest start time and latest end time to give an accurate view of the runtime.

tags dropdown in new version?

image

We had tags dropdown in old version - I think it was helpful to filter to view specific list of scenarios. Any way to bring it back/enable in new version?

json report - steps to use report_builder gem

I have a json results generated in my ruby cucumber framework. let me know how to use the report_builder gem in my framework

C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/report_builder-1.7/lib/report_builder/builder.rb:81:in get_groups': Error:: No file(s) found at C:\RubyAutomation\Features\results\cucumber_json (RuntimeError) from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/report_builder-1.7/lib/report_builder/builder.rb:22:in build_report'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/report_builder-1.7/lib/report_builder.rb:76:in build_report' from C:/RubyAutomation/Features/support/hooks.rb:48:in block in <top (required)>'

report path

When I use the code examples in my jruby project, the reports are getting generated successfully.
However, it is generated only at the project root directory and not in the path that I specify.

When I specify a particular path for the report to get generated, I see
RuntimeError: Error:: No file(s) found at ... (at the project root directory)

Lets give ReportBuilder a better configuration design.

Due to how many parameters ReportBuilder supports --- why don't we implement one of the following new approaches.

1 . Have ReportBuilder take a hash of options

options= {json_path: 'xxx/xxxx/xxx' , report_path: 'xxx/xxxx/xxx' , report_types: [:html, :json] }
ReportBuilder.build_report(options)

2 . Have ReportBuilder support being configured via a block call which will consume the parameters.

ReportBuilder.configure do | config |
     config.json_path = '/xxx/xxxx/xxxx'
     config.report_path = /xxx/xxxx/xxxx'
     config.report_types = [:html, :json]
     config.report_tabs = [:features, :scenarios, :errors]
     config.compress_images = true
  end

ScenarioOutput Data Requires Formatting

Hey @rajatthareja ,

I am testing the new release and I have been thinking of how we can handle formatting ScenarioOutput data. One thing I find interesting is that the newlines show up if you inspect the HTML source, but they do not show up in the report.

I have made an album of images to show the issue in detail:
Cucumber ReportBuilder Output JSON Formatting Issue

  • Image 1, how it looks in HTML Report
  • Image 2, how it looks in Terminal
  • Image 3, how it looks when inspecting the HTML element in chrome
  • Image 4, how it looks in JSON

The \n are required for the terminal output and Cucumber directly writes whatever the Terminal receives into the JSON file. It would appear that we need to add a .gsub('\n', '< b r / >) when reading out this data from the JSON. I believe that would fix the issue.

Let me know what you think, or if you have a better idea.

More flexible report naming

Currently all reports generated by the builder have the same name and differ only by their file extension (e.g. foo.html, foo.json, foo.retry). It would be useful to be able to specify different, more meaningful names to the different report types (e.g. report.html, raw.json, failures.retry).

Retry failure format

In addition to the JSON and HTML formats, is there any chance that a retry format could be added that would generate a single rerun file similar to what the rerun formatter does for Cucumber?

e.g.

features/foo.feature:5
features/bar.feature:7:13
features/nested/thing.feature:13

Alternatively, this could be another tab in the HTML report instead of a separate file (but preferably still in list format so that it can be copy/pasted into a file for consumption by Cucumber).

Output in the reports

There are instances where we need to publish the output with puts and in such cases, cucumber prints the output in the cucumber reports.

Is there a way to do that in report_builder? capture whatever printed in the terminal?

Configuration is broken

The 1.5 release broke the ability to configure report building options.

ReportBuilder.configure do |config|
  # configure stuff
end

ReportBuilder.build_report

no longer works but

ReportBuilder.build_report({some: options})

does work.

This appears to be the result of some of the changes that happened during the recent class extraction effort by @cheezy.

FYI: It's a one line fix. I'll get to it today.

Support for saving/exporting the combined JSON file

Hey,

This is a fantastic gem but I think one key part which is missing is the ability to export / save the combined JSON such that you can use it elsewhere. In fact, this gem is currently one of the best JSON combiners for cucumber.

Report Improvements - Add Ability to Pass Env Variables To Report

We have several environments where we run our tests, it would be great to have the ability to pass Env Variables to the report. We'd like to include build number, git branch, environment, browser, etc to the header. So at first glance anyone looking at the report will know where the tests ran.

Mockup:
image

Getting Encoding Issue

Getting below output -

Link embedding skipped!
Encoding::UndefinedConversionError
"\xC2" from ASCII-8BIT to UTF-8
/Users/home/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/builder-3.2.3/lib/builder/xmlmarkup.rb:281:in write' /Users/home/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/builder-3.2.3/lib/builder/xmlmarkup.rb:281:in <<'
/Users/home/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/builder-3.2.3/lib/builder/xmlmarkup.rb:281:in _text' /Users/home/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/builder-3.2.3/lib/builder/xmlbase.rb:118:in <<'
/Users/home/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/report_builder-0.1.4/lib/report_builder.rb:433:in block (2 levels) in build_embedding' /Users/home/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/builder-3.2.3/lib/builder/xmlbase.rb:175:in _nested_structures'
/Users/home/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/builder-3.2.3/lib/builder/xmlbase.rb:68:in tag!' /Users/home/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/builder-3.2.3/lib/builder/xmlbase.rb:190:in block (2 levels) in cache_method_call'
/Users/home/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/report_builder-0.1.4/lib/report_builder.rb:432:in block in build_embedding' /Users/home/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/report_builder-0.1.4/lib/report_builder.rb:401:in each'
/Users/home/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/report_builder-0.1.4/lib/report_builder.rb:401:in `build_embedding'
Link embedding skipped!

Please let me know how I will override this error

Not handling well special characters

I have this special character in a json file: "–"
The report is showing like: ΓÇô

Could you please take a look on this?
Thank you in advance.

Embedded reports broken in version 1.0

After upgrading from 0.1.6 to 1.0, the embedded screenshots no longer display in the report. I'm using the following code to embed the images:
In hooks.rb -

After do |scenario|
  if [email protected] && scenario.failed? && [email protected]?
    encoded_image = @browser.screenshot.base64
    embed("data:image/png;base64,#{encoded_image}","image/png")
  end
end

In the report builder script file -

require 'report_builder'

html_report_name = ARGV[0]
app_id = ARGV[1]

ReportBuilder.configure do |config|
  config.json_path = '.'
  config.report_path = html_report_name.gsub(/\.html/,'')
  config.report_types = [:html]
  config.report_tabs = [:features, :scenarios, :errors]
  config.report_title = "title - #{app_id}"
end

ReportBuilder.build_report

When I get a set of files that I can upload without disclosing customer data I will.

Support for scenario output data from JSON

Cucumber allows you to write scenario data to the HTML / JSON reports by calling puts during a scenario or in an after hook. It would be great if this data was displayed in the HTML report per scenario.

here is an example block of JSON showing this data, it is in a field called 'output'

      {
        "id": "flyout-login;leave-password-field-blank",
        "keyword": "Scenario",
        "name": "Leave Password Field Blank",
        "description": "",
        "line": 15,
        "type": "scenario",
        "tags": [
          {
            "name": "@non-mobile",
            "line": 1
          }
        ],
        "before": [
          {
            "match": {
              "location": "features/support/env.rb:78"
            },
            "result": {
              "status": "passed",
              "duration": 21000
            }
          }
        ],
        "steps": [
          {
            "keyword": "When ",
            "name": "I login via the flyout using:",
            "line": 16,
            "match": {
              "location": "features/step_defenitions/cnc_steps.rb:103"
            },
            "result": {
              "status": "passed",
              "duration": 939568000
            }
          },
          {
            "keyword": "Then ",
            "name": "exactly (1) [validation_error] should be visible",
            "line": 20,
            "match": {
              "location": "features/step_defenitions/global_steps.rb:28"
            },
            "result": {
              "status": "passed",
              "duration": 87766000
            }
          }
        ],
        "after": [
          {
            "match": {
              "location": "features/support/env.rb:85"
            },
            "result": {
              "status": "passed",
              "duration": 255000
            },
            "output": [
              "\nvisibility_checks:\n - Found 1 validation_error (expected exactly 1)\n\nscenario_timer:\n 1.0 seconds"
            ]
          }
        ]
      }

Images not displaying 1.1

Maybe I'm missing something, but my images are still not being displayed. The last version where images were displayed for me is 0.1.4.

Here's my code for embedding the image:

@browser.driver.save_screenshot(screenshot_file)
embed(screenshot_file, 'image/png')

Here's what ends up being displayed in the new erb report.

By�Y�z�����N�������F���*00PIIIJOO�]wݥ�>�H�<����&�Ÿ���v-\�PIII�z�f���PGG�����������egg�ȑ#*++�������Su(<�ϔ�m�Cbb�BCC�DZ����C�������>ۣ�b��fS@@�jjj���>A-�x�Ӏz���JKK���V������������e3�LRR�*++u���}��7����һᆱ��%''���`�Z�������x���\.���+ںu�JJJ������x�b����Z�j�222��㏫��f�[��Mpp�V�Z���0544�̙3������6�	UFF�f̘��˗��ɓ:{������g�ٔ�����8����j�������_UU5�M��37�|�����<}ww���8@G�IӧOעE�t��)#� ������l6k޼yJHH�G�}����qo�df�Z���uś%�f�"##���E��kܘ��)))��ӗOWUU�K�.�USF����������I깻�Wҡ7���>☘���n��ձc�έ[�N�<��jkk���O�{sCgg����g��}�k_���߮����z�G(q�qa�Zu�M7),,L�.\�ѣG%I��C��᪩����Tkk���?���b�t�M�;w����U\\<���Q,''G^�W���������R@@����������&�:tH ��\�Q5}��a��R�u�y��]��uRR��-[&�ɤ���(66�������X�|�� ....

Jruby Compatibility Issue

When using report builder 1.0+ with Jruby 9.1.12.0 I came across this issue:

TypeError: no implicit conversion of String into Integer
                     [] at org/jruby/RubyArray.java:1458
        block in result at (erb):53
                   each at org/jruby/RubyArray.java:1734
        each_with_index at org/jruby/RubyEnumerable.java:1067
        block in result at (erb):52
                   each at org/jruby/RubyArray.java:1734
        each_with_index at org/jruby/RubyEnumerable.java:1067
        block in result at (erb):22
                   each at org/jruby/RubyArray.java:1734
        each_with_index at org/jruby/RubyEnumerable.java:1067
                 <eval> at (erb):21
                   eval at org/jruby/RubyKernel.java:1000
                 result at C:/jruby-9.1.12.0/lib/ruby/stdlib/erb.rb:864
  block in build_report at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/report_builder-1.2/lib/report_builder/builder.rb:33
                   open at org/jruby/RubyIO.java:1156
           build_report at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/report_builder-1.2/lib/report_builder/builder.rb:32
           build_report at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/report_builder-1.2/lib/report_builder.rb:45
        block in (root) at C:/Automation/RubyAutomationBase/web_driver_support/hooks.rb:78

This is due to using .each_with_index without using the index in some jruby versions. This was fixed for jruby 9.1.13 however is still a problem for 9.1.12 and below. I have created a pull request #52 for resolving this issue for Jruby versions older than 9.1.13.

Support for embedded Base64 images in JSON.

It would be great if you could embed the Base64 images which cucumber generates, into the HTML report. I would be happy to help with this as a pull request if you are unsure of how to implement.

love the gem, it is great!

           "keyword": "And ",
            "name": "I should not be logged in",
            "line": 58,
            "match": {
              "location": "features/step_defenitions/cnc_steps.rb:94"
            },
            "result": {
              "status": "skipped"
            }
          }
        ],
        "after": [
          {
            "match": {
              "location": "features/support/env.rb:85"
            },
            "result": {
              "status": "passed",
              "duration": 502779000
            },
            "embeddings": [
              {
                "mime_type": "image/png",
                "data": "iVBORw0KGgoAAAANSUhEUgAACQAAAAhKCAIAAABSiLKtAAAgAElEQVR4nOzdeZRcdZ03/s/33lv7XtVdVb2v6e50Z+1OAoEEDIZVZAQe9YePOM8TdXQeF5RRZkRxQBx1DnNcGJ2RUXl8DiOgI4PKaggRY0ggO1k6nd67el+q99rr3u/vj29SVKqrl3Q6IYT363g4ya273xzPvfd9P58vy8vLIwAAAAAAAAAAAAAAAICL69ChQ4wxp9PJGCMi8d95pc/GOc/

json report - result is overwritten and not appended

After running multiple features (in single run) only last feature result is retained in the report i.e. result is overwritten and not appended in json. Please note that we are using database truncation policy after each scenario.
Below for reference

  1. below in cucumber.yml -
    default: -f json -o features/reports/report<%= ENV['TEST_ENV_NUMBER'] %>.json -f html -o features/reports/my_test_report<%= ENV['TEST_ENV_NUMBER'] %>.html -f pretty
  2. env.rb - attached

Thanks in advance.

env.txt

show time to execute in report

image

Time to execute on scenario and step level.
I think this was also an important feature - any way to bring it back or enable it in new version?

undefined method `merge!'

Hi, I can't make it work, always get:
report_builder.rb:83:in build_report': undefined methodmerge!' for nil:NilClass (NoMethodError)

$ ruby -v
ruby 1.9.3p551 (2014-11-13) [i386-mingw32]

$ cucumber --version
2.3.2

I tried with rubygems repository, with git repository and nothing.
Can you help me please?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.