PyReport
Quick overview
PyReport is a lightweight reporting plugin for Pytest that provides concise HTML reports by parsing JunitXML test results
Pre-requisites
To be able to use this plugin you will need below dependencies that will be installed automatically with PyReport:
- Python >=3.7
- Jinja2
- Pytest
- matplotlib
- requests
- logstyle
Getting started
Installation
To start using PyReport please follow below instructions:
- Install
pytest-pyreport
plugin:
pip install pytest-pyreport==<version>
Report generation
-
Run tests using below command to generate pyreport.html file with test results:
pytest --junitxml=result.xml -o junit_family="xunit1" --pyreport
-
Run tests using below command if you want to send telegram notification:
pytest --junitxml=result.xml -o junit_family="xunit1" --pyreport --telegram-pyreport <chat id> <bot token>
- Prerequisites:
- You need your own Telegram bot, which can be easily created using Telegram instructions. You can take the “chat ID” and “bot token” from there.
- Prerequisites:
-
Run tests using below command if you want to check generated report on the server if it is available:
pytest --junitxml=result.xml -o junit_family="xunit1" --pyreport --telegram-pyreport <chat id> <bot token> --server <URL>
- Prerequisites:
- You need to run server beforehand. As an example using CI/CD tools like Jenkins or GitHub Actions
- Prerequisites:
Test results
- Once test run completed you should see
pyreport.html
file that auto generated by using above commands.
Open it and check the test results as shown in below presentation