Allure Reports in Behave BDD

Tutorial​​ 14​​ ​​ Allure Reports​​ in Behave BDD

Welcome to the 14th article in Behave BDD series!

What you will Learn:

  • Install allure package

  • Generate allure report in json format

  • Convert json to​​ html format

  • Understand html allure report

Install allure package

Execute the below commands to switch to virtual environment

​​ 

Execute the command to install allure-behave package:
pip install allure-behave


So allure reports package is installed in our virtual env.

Next, in your PyCharm IDE, go to File > Settings​​ 

The below window comes up. You can​​ see allure-behave package

Generate allure report in json format

Next, let us see how to generate the report in json format. Below is the syntax to generate the allure report. The ‘reports’ folder will be automatically created​​ 

behave -f allure_behave.formatter:AllureFormatter -o reports/​​ <featurefilename.feature>

So, let us execute the above command in terminal using any feature file:

As expected, the selenium script runs

Notice below that ‘reports’ folder gets created having reports in json format

Right now, the data is raw inside the json file

Convert json to html format

Let us convert this json file into​​ html​​ report​​ format.

To do that, execute the command:

allure serve reports/

Click ‘Allow access’

The html report gets generated and the is automatically shown in a new browser window​​ 

You can see below the path of index.html report being generated

You can copy this path and go to the folder if required​​ 

Understand html allure report

You can see below that 2 scenarios got passed (seen as 100%)

Under 'FEATURES BY STORIES', you can click the feature file to see the details

When you click the feature, the below window will show the details

Similarly, on the left hand side, you can click ‘Graphs’

Finally​​ Press Ctrl+C to exit from report

This is how we​​ generate the allure reports using behave BDD.

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 - 10000 RS/149 USD
Attend All Live courses in just 10000 rs / $149 - offer ends 31st May 2024