0
votes

I am using protractor cucumber framework for automation testing. I am using Protractor-multiple-cucumber-html-reporter-plugin to generate reports. Can we used print test data in reports? Or Atleast, can we print test data for failure test cases in report where error message is showing?

1
Are you framework is included with World? - Sreenivasulu
Hii.. No my framework is not included with World.. - Snehal
This can be doable using hooks and World concept in cucumber framework. Refer below pages to get more information on it: github.com/cucumber/cucumber-js/blob/master/docs/support_files/…, github.com/cucumber/cucumber-js/blob/master/docs/support_files/… - Sreenivasulu

1 Answers

0
votes

Yes, you can. Push your test data into Buffer, which is a node js concept and attach it to this.world like below in hooks file

   After(async function () {
    const userDetails = Buffer.from(JSON.stringify(Shared.userDetails));
    await this.World.attach(userDetails, 'application/json');
    const testData = Buffer.from(JSON.stringify(Shared.testDataObj));
    await this.World.attach(testData, 'application/json');
});

At the end cucumber will fetch entire data from this.world and store in cucumber-json-report.json, which we use to generate report with the help of cucumber-html-reporter.