Test Observability & Engineering effectiveness
“Engineering Effectiveness” has been a central topic of discussion and focus this year
Testing across all interfaces, platforms and architectural components
Product test engineering, Shift-Left testing and digital transformation
Automate tests across all interfaces, platforms and horizontal scaling
Generative AI, Flutter, React Native, Micro-services, Micro-frontends & TestOps
Measure and enhance the efficiency & effectiveness of testing teams & solutions
Offshore Testing Setup as a Service, platform engineering and Modernisation
Generating Allure reports in the Pytest framework
This blog is a step-by-step guide to understand & implement allure test reports in a pytest framework.
Allure Framework is a flexible lightweight multi-language test report tool that not only shows a very concise representation of what has been tested in a neat web report but allows everyone participating in the development process to extract the maximum useful information from the everyday execution of tests.
Let us now understand how can we add allure reporting support to the pytest framework.
pip install allure-pytest
That’s it, We need only this to be installed in our system, We can install it using pip (The above command) or if we are using pycharm we can head to Preference → Project → Project Interpreter → click on the + icon
A window name “Available Packages” will be opened
Search with “allure-pytest” → Select the first result → click on Install Package.
This will install the required package for allure-pytest.
Now, Just use the below flag with your existing command.
pytest --alluredir= test.py
This will generate a directory to the specified path with some files in JSON format.
Now, we have the supported data that will be required to get the report, We just need to convert it into HTML so that we can see this on the browser.
Hit the below command in the terminal/cmd
allure serve
Note: <path to report directory> this should be the same path where we generated the allure files.
It will start a jetty server within a few seconds and the report will be visible inside your browser.
This is it, following these few steps, we will be able to generate and see the report in the browser.
We can configure a lot more stuff inside the allure report like ENV, Severity, Trends, screenshot and etc. You can refer to the official documents for getting these features.
Hope the blog helped you to get a better understanding of how to generate Allure reports in the pytest framework.
“Engineering Effectiveness” has been a central topic of discussion and focus this year
With us, you’re not just a part of a company; you’re part of a movement dedicated to pushing boundaries, breaking barriers, and achieving the extraordinary.
Otaku 2.0 sought to redefine the way we approach testing, celebrate the spirit of innovation, and pave the way for a brighter future in tech.