webdriverio-boneyard / wdio-cucumber-framework

A WebdriverIO v4 plugin. Adapter for Cucumber testing framework.
MIT License
77 stars 61 forks source link

Not all cucumber data is added to the reporter #133

Closed wswebcreation closed 6 years ago

wswebcreation commented 6 years ago

When using CucumberJS standalone you can get an very comprehensive JSON report containing more info than wdio-cucumber-framework is providing.

I miss for example the following data when I try to build my own reporter:

The data itself can be retrieved from the reporter with for example the following feature

Feature: Create data feature
    This is a feature description

    Scenario: a table scenario
        This should be a scenario description
        Given a table step
            | Cucumber     | Cucumis sativus |
            | Burr Gherkin | Cucumis anguria |

When I place some logs in the reporter.js I see I get the data

handleBeforeFeature
feature =  { type: 'Feature',
  tags: [],
  location: { line: 2, column: 1 },
  language: 'en',
  keyword: 'Feature',
  name: 'Create data feature',
  description: '    This is a feature description',
  children: 
   [ { type: 'Scenario',
       tags: [],
       location: [Object],
       keyword: 'Scenario',
       name: 'a table scenario',
       description: '        This should be a scenario description',
       steps: [Array] } ] }

handleBeforeScenario
scenario =  { tags: [],
  name: 'a table scenario',
  language: 'en',
  locations: [ { line: 5, column: 5 } ],
  steps: 
   [ { text: 'a table step', arguments: [Array], locations: [Array] } ] }

handleBeforeStep
step =  { type: 'Hook',
  location: 
   { line: 90,
     column: 0,
     uri: 'Projects/wdio-multiple-cucumber-html-reporter/node_modules/cucumber/src/support_code_library_builder/define_helpers.js' },
  keyword: 'Hook',
  text: '' }

handleBeforeStep
step =  { type: 'Step',
  location: { line: 7, column: 9 },
  keyword: 'Given ',
  text: 'a table step',
  argument: 
   { type: 'DataTable',
     location: { line: 8, column: 13 },
     rows: [ [Object], [Object] ] } }

handleBeforeStep
step =  { type: 'Hook',
  location: 
   { line: 90,
     column: 0,
     uri: 'Projects/wdio-multiple-cucumber-html-reporter/node_modules/cucumber/src/support_code_library_builder/define_helpers.js' },
  keyword: 'Hook',
  text: '' }

Is there a reason to not expose this data? And if not, do you also allow a PR to add that data? It would help a lot making more readable reports.

Tnx in advance

wswebcreation commented 6 years ago

Status update: Started with the initial setup. Reporter is already adjusted, now need to add some tests and make a PR, see https://github.com/wswebcreation/wdio-cucumber-framework/blob/feature/enrich-reporter/lib/reporter.js

wswebcreation commented 6 years ago

This has been fixed with https://github.com/webdriverio/wdio-cucumber-framework/pull/136 and released in version 2.2.0