mavdi / grunt-cucumberjs

Grunt plugin for cucumber.js
MIT License
31 stars 36 forks source link

Extract templates and report generation to separate npm module #60

Closed mucsi96 closed 8 years ago

mucsi96 commented 8 years ago

It would be very helpful to extract the template and html report generation to a separate npm module with a Javascript API. I would like to use it in my https://github.com/mucsi96/nightwatch-cucumber module and I don't what to copy-past you html template related code.

Do you think it is possible? Thanks Igor

mucsi96 commented 8 years ago

May the best would be to put it inside https://github.com/cucumber/cucumber-html What do you think? Thanks

gkushang commented 8 years ago

Hi @mucsi96 Thanks for the request, and sorry for the late response.

It would be very nice to have this support in night-watch as well. I have few thoughts, @mavdi , please chime in what you think as well?

@mucsi96 What if we separate out the grunt command and provide you with the cucumber-runner, which would produce HTML report as well as support for parallel executions? Do you think that would fulfill your request? Let us know

mucsi96 commented 8 years ago

@gkushang Thanks for response. Nightwatch-cucumber is using Nightwatch.js runner which has parallel execution built in. I need a very simple API which is capable to generate html report from cucumber json formatter output. So basicly I need only the generateReport function.

mavdi commented 8 years ago

Yup this works for me absolutely. How do you want to proceed?

mucsi96 commented 8 years ago

I see 3 ways to proceed.

  1. Is the hardest but the best for most developers :). Is to reimplement the template generation logic in Go and create a PR to https://github.com/cucumber/cucumber-pretty-formatter
  2. Is to compare the template generation logic with https://github.com/leinonen/cucumber-html-report. And may be provide PR. This package is owning the cucumber-html-report name. I think the best for this functionality.
  3. Is to create a new npm package with name cucumber-html-reporter or cucumber-html-formatter and GitHub repo. But currently we have 5 different html reporters in npm :)
gkushang commented 8 years ago

@mucsi96 - WIP

var cucumberHtmlReporter = require('grunt-cucumberjs')().htmlReporter;
....
....
  var options = {
    theme: 'bootstrap',
    output: 'tests/acceptance/report.html',
    jsonFile: 'tests/acceptance/features_report.html.json'
  };

  cucumberHtmlReport.generate(options);

We can PR to the external html modules and also to the cucumber-html as an additional reporting format.

Let us know what do you think about it.

mucsi96 commented 8 years ago

I saw you created the https://github.com/gkushang/cucumber-html-reporter. That is amazing! Thank you!