The resultJsonOutputFile
will generate json file attributed to protractor and will contain basic specs information. Since you are using Cucumber as your testing framework with protractor you would have to generate Cucumber-Report.json
which cucumber generates.It will have all your step definition details! In order to achieve this you could add below code in your hooks.js
file:
var Cucumber = require('cucumber'); //npm install -g cucumber
var jsonReporter = function () {
"use strict";
var outputDir = './Reports/';
var JsonFormatter = Cucumber.Listener.JsonFormatter();
JsonFormatter.log = function (string) {
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir);
}
var targetJson = outputDir + 'cucumber_report.json';
fs.writeFile(targetJson, string, function (err) {
if (err) {
console.log('Failed to save cucumber test results to json file.');
console.log(err);
}
});
};
this.registerListener(JsonFormatter);
module.exports = jsonReporter;
This would create a Reports
folder and in that you would see cucumber_report.json
file