Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/toghrulmirzayev/pytest-pyreport
PyReport is a lightweight reporting plugin for Pytest
https://github.com/toghrulmirzayev/pytest-pyreport
pytest-plugin qa qa-automation reporting telegram test-automation testing
Last synced: 10 days ago
JSON representation
PyReport is a lightweight reporting plugin for Pytest
- Host: GitHub
- URL: https://github.com/toghrulmirzayev/pytest-pyreport
- Owner: ToghrulMirzayev
- License: mit
- Created: 2023-05-07T14:58:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-05T19:59:28.000Z (6 months ago)
- Last Synced: 2024-10-18T17:02:12.601Z (20 days ago)
- Topics: pytest-plugin, qa, qa-automation, reporting, telegram, test-automation, testing
- Language: Python
- Homepage:
- Size: 431 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# PyReport
![PyPI - Downloads](https://img.shields.io/pypi/dm/pytest-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# Supported Messengers
* Telegram
* Slack# Getting started
## Installation
To start using PyReport please follow below instructions:* Install `pytest-pyreport` plugin:
```
pip install pytest-pyreport==
```## 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
```
* 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.
---
* Run tests using below command if you want to send Slack notification
```
pytest --junitxml=result.xml -o junit_family="xunit1" --pyreport --slack-pyreport
```
* Prerequisites:
* You need your own Slack bot, which can be easily created using Slack instructions.
You can take the “webhook url”, "channel id" and “bot token” from there.
---
* 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 --server
pytest --junitxml=result.xml -o junit_family="xunit1" --pyreport --slack-pyreport --server
```
* Prerequisites:
* You need to run server beforehand. As an example using CI/CD tools like Jenkins or GitHub Actions---
* Run tests with failed tests counter. By running below command you will get JSON file with percentage of failed tests:
```
pytest --junitxml=result.xml -o junit_family="xunit1" --pyreport --failed-tests-count
```
* Fail percentage formula:
```text
Failed Tests Percentage = (Number of Failed Tests / Total Number of Tests) * 100
= (10 / 100) * 100
= 10%
```
* Example `fail_percentage.json`:
```json
{"fail_count": 10, "fail_percentage": 10.0}
```
## 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## Presentation
![pyreport](https://toghrulmirzayev.github.io/pytest-pyreport/presentation.gif)