Cucumber_BDD_Reports-Part 1

Tutorial 11​​ ​​ ​​ Cucumber​​ Reports​​ – Part 1

What you will Learn :

  • Generate json report

  • Generate xml​​ report

  • Publish report on cucumber cloud​​ using publish = true

Generate json report

Open the Test Runner file (here ‘TagTest.java). To generate a json report, we will mention the​​ path of json file in the ‘plugin’ option, see below. We start with mentioning the name of the tag ‘json’. We then mention ‘target’ which means the ‘target’ folder where we want to generate the report. Inside the ‘target’ folder, we can mention any desired sub-folder name, here ‘MyCucReports’. Finally we mention the name of the report with .json extension, here Report.json

Save the file

Let us run our Test Runner file, see below

Notice the console output, see below. There is no error

Now right click your project folder and click ‘Refresh’

After you refresh, just expand the ‘target’ folder that you see on the left hand side, see below. Inside the ‘target’ folder, expand the​​ ‘MyCucReports’ sub-folder. You would see Report.json under this sub-folder

​​ 

Double click Report.json, you would see the report in json format. You would see the ‘status’ of each scenario, whether it got passed/failed etc

​​ 

Generate xml report

To generate the junit xml report, add the line show below

Save the file

Let us run our Test Runner file, see below

Now right click your project folder and click ‘Refresh’

After you refresh, just expand the ‘target’ folder. Inside the ‘target’ folder, expand the ‘MyCucReports’ sub-folder. You would see Report.xml under this sub-folder

Double click Report.xml. You would see the junit xml reports in the junit section, see below. You can see the respective scenarios with a green tick​​ ​​ which means that they got passed

So these are 2 basic cucumber reports.​​ 

Publish report on cucumber cloud​​ using publish = true

From cucumber ver 6.9 onwards, the cucumber team has started to publish report on their cloud. If you look at the console output, you would see​​ a Junit cucumber options​​ setting, see below: publish​​ =​​ true​​ 

Let us use this setting. Simply write ‘publish = true’ as seen below

Save the file

Let us re-run the test runner file

See the console o/p now. We are no longer getting the earlier message to set the property. Just copy the below link​​ to view cucumber report

Paste it in a browser to see the report. You can see that​​ 3 scenarios got executed with 100% pass coverage

You can also click at the feature file link that is shown in the report to view your feature file, see below

As mentioned, the report will get automatically deleted after 24 hours

You can also delete the report manually by clicking ‘Delete Report’, see below

Once you delete the report manually, you would see some sample reports published by someone else


Also if you scroll down the page, you would see some FAQs, see below

Thank you​​ for reading!

Share On

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp
Share on tumblr
Share on email

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

Lifetime Membership Club

LIFETIME MEMBERSHIP BIG SALE - ALL LIVE COURES JUST - 7000 RS/ 99 USD
Attend All Live courses in just 7000 rs / $99 - offer ends 10th Nov 2024