I am using Protractor with Cucumber (js). I would like to generate report files just like with the Cucumber-JVM version. I have seen examples when using Protractor with Jasmine, but practically nothing with Cucumber.
How do you generate reports when using this configuration?
The final goal is to publish this report in Jenkins, or anywhere else if they are directly generated in HTML.
Thanks!
Show activity on this post. Take a browser screenshot after each failed scenario to be attached to the json report in the After-hook. Write the test results to a json-file even if your cucumber opts format property says 'pretty'. Convert the json report to HTML, including screenshots for failed scenarios.
To use Multiple Cucumber HTML Reporter it must be run in a separate node executable after the cucumber-js process finishes. IMPORTANT: Make sure that, when you generate the JSON files with Cucumber, each file will have a UNIQUE name. If you don't provide a unique name Cucumber will override the JSON files.
With the latest version of protractor (from version 1.5.0), you can now generate a JSON report. When I asked this question about 7 months ago that feature was not there.
All you need to do is add this to your protractor-config.json file.
resultJsonOutputFile: 'report.json'
Where report.json is the location of the output file.
Once you have that, you can use protractor-cucumber-junit (https://www.npmjs.com/package/protractor-cucumber-junit), cucumberjs-junitxml (https://github.com/sonyschan/cucumberjs-junitxml) or something similar to transform the JSON file into a valid XML file that Jenkins can display.
$ cat report.json | ./node_modules/.bin/cucumber-junit > report.xml
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With