Cucumber HTML report with Protractor

后端 未结 4 725
失恋的感觉
失恋的感觉 2020-12-15 22:52

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 Jasm

4条回答
  •  抹茶落季
    2020-12-15 23:19

    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.

提交回复
热议问题