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