Is there a Protractor Reporting Tool that works with a cucumber framework? [closed]

佐手、 提交于 2019-12-17 14:58:15

问题


Using protractor with cucumber and need a plug in or tool (free if possible) that will create a user friendly test report or at least a file that a test report can be generated from. Thank you!


回答1:


The easiest thing to do is to compliment your current setup with the free and open-source Serenity/JS.

Serenity/JS is a next generation acceptance testing library, but in the most basic scenario, it can also act as an integration layer between Protractor and Cucumber.

This enables you to:

  • Run your tests in parallel and still get the aggregated, user-friendly test reports.
  • Enhance your test reports with screenshots of your app's UI without any additional plugins.
  • Fix some common problems related to Cucumber/WebDriver ControlFlow synchronisation and inaccurate reporting with just a single config change.
  • Try the Screenplay Pattern in some part of your project while keeping your other tests working as they used to. This way you minimise the risk of disrupting the work of your team while improving your tool set.

The below setup instructions are explained in detail in the manual, and the reports you'll get will look like this:

Setup

Install the serenity-js module from the npm and save it as a development dependency:

npm install serenity-js --save-dev

With the serenity-js module installed, you can update your Protractor configuration file to include:

exports.config = {
    framework: 'custom',
    frameworkPath: require.resolve('serenity-js'), 
    // ...
}

If you're currently using the protractor-cucumber-framework, you can simply replace it with serenity-js.

Report generation

Serenity/JS produces test execution reports in json format and to convert them to html you'll need serenity-cli (which is a node.js wrapper around the Serenity BDD CLI, which in turn is a Java program and you'll need the Java Runtime Environment 7 or newer to run it).

Install serenity-cli and save it as a development dependency:

npm install serenity-cli --save-dev

Next, add the following npm scripts to your package.json file:

 "scripts": {
    "prereport": "serenity update",
    "report":  "serenity run",

    // other scripts ...
  },

With the above setup complete running your protractor tests will produce test reports in the json format together with screenshots under target/site/serenity, and running npm run report will process those intermediary reports and produce the user-friendly HTML version you're after.

Hope this helps,

Jan




回答2:


I'm using the cucumberjs-allure-reporter package and it provides a pretty extensive reporting capability. I've been able to create hooks that take screen shots, capture browser logs and network traffic reports after each step allowing me to track quite a bit of information for each test.

Instructions for setting it up is a bit vague, but once you find all of the info, it works like a charm.




回答3:


you can try https://www.npmjs.com/package/cucumber-html-reporter, which integrates well with the Protractor

e.g. HTML Preview of Report with Pie Charts

Screenshot




回答4:


https://github.com/igniteram/protractor-cucumber-allure

Use the above repo. It has two different html reports within it. you can also use the hooks to screenshot when there is a failure. I tried it and it works like a charm.



来源:https://stackoverflow.com/questions/34821016/is-there-a-protractor-reporting-tool-that-works-with-a-cucumber-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!