# 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 <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Telegram_2019_Logo.svg/512px-Telegram_2019_Logo.svg.png?20231105064641" alt="Telegram" width="30" height="30">
* Slack <img src="https://raw.githubusercontent.com/devicons/devicon/55609aa5bd817ff167afce0d965585c92040787a/icons/slack/slack-original.svg" alt="Slack" width="30" height="30">
# 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 <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Telegram_2019_Logo.svg/512px-Telegram_2019_Logo.svg.png?20231105064641" alt="Telegram" width="30" height="30">
```
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.
---
* Run tests using below command if you want to send Slack notification <img src="https://raw.githubusercontent.com/devicons/devicon/55609aa5bd817ff167afce0d965585c92040787a/icons/slack/slack-original.svg" alt="Slack" width="30" height="30">
```
pytest --junitxml=result.xml -o junit_family="xunit1" --pyreport --slack-pyreport <webhook url> <channel id> <bot token>
```
* 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 <chat id> <bot token> --server <URL>
pytest --junitxml=result.xml -o junit_family="xunit1" --pyreport --slack-pyreport <webhook url> <channel id> <bot token> --server <URL>
```
* 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)
Raw data
{
"_id": null,
"home_page": "https://github.com/ToghrulMirzayev/pytest-pyreport",
"name": "pytest-pyreport",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "pytest_pyreport, python, pytest, report, slack, telegram, messenger, pyreport",
"author": "Toghrul Mirzayev",
"author_email": "togrul.mirzoev@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/69/b1/7a5072f06bf19cfdf98e58b3228630cdf8759baaacef710ac7e67eedbe57/pytest_pyreport-1.6.0.tar.gz",
"platform": null,
"description": "# PyReport\n\n![PyPI - Downloads](https://img.shields.io/pypi/dm/pytest-pyreport)\n\n# Quick overview\nPyReport is a lightweight reporting plugin for Pytest that provides concise HTML reports by parsing JunitXML test results\n\n# Pre-requisites\nTo be able to use this plugin you will need below dependencies that will be installed automatically with PyReport:\n* Python >=3.7\n* Jinja2\n* Pytest\n* matplotlib\n* requests\n* logstyle\n\n# Supported Messengers\n* Telegram <img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Telegram_2019_Logo.svg/512px-Telegram_2019_Logo.svg.png?20231105064641\" alt=\"Telegram\" width=\"30\" height=\"30\">\n* Slack <img src=\"https://raw.githubusercontent.com/devicons/devicon/55609aa5bd817ff167afce0d965585c92040787a/icons/slack/slack-original.svg\" alt=\"Slack\" width=\"30\" height=\"30\">\n\n# Getting started\n## Installation\nTo start using PyReport please follow below instructions:\n\n* Install `pytest-pyreport` plugin:\n```\npip install pytest-pyreport==<version>\n```\n\n## Report generation\n* Run tests using below command to generate pyreport.html file with test results:\n ```\n pytest --junitxml=result.xml -o junit_family=\"xunit1\" --pyreport\n ```\n---\n* Run tests using below command if you want to send Telegram notification <img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Telegram_2019_Logo.svg/512px-Telegram_2019_Logo.svg.png?20231105064641\" alt=\"Telegram\" width=\"30\" height=\"30\">\n ```\n pytest --junitxml=result.xml -o junit_family=\"xunit1\" --pyreport --telegram-pyreport <chat id> <bot token>\n ```\n * Prerequisites:\n * You need your own Telegram bot, which can be easily created using Telegram instructions.\n You can take the \u201cchat ID\u201d and \u201cbot token\u201d from there.\n---\n* Run tests using below command if you want to send Slack notification <img src=\"https://raw.githubusercontent.com/devicons/devicon/55609aa5bd817ff167afce0d965585c92040787a/icons/slack/slack-original.svg\" alt=\"Slack\" width=\"30\" height=\"30\">\n ```\n pytest --junitxml=result.xml -o junit_family=\"xunit1\" --pyreport --slack-pyreport <webhook url> <channel id> <bot token>\n ```\n * Prerequisites:\n * You need your own Slack bot, which can be easily created using Slack instructions.\n You can take the \u201cwebhook url\u201d, \"channel id\" and \u201cbot token\u201d from there.\n---\n* Run tests using below command if you want to check generated report on the server if it is available:\n ```\n pytest --junitxml=result.xml -o junit_family=\"xunit1\" --pyreport --telegram-pyreport <chat id> <bot token> --server <URL>\n pytest --junitxml=result.xml -o junit_family=\"xunit1\" --pyreport --slack-pyreport <webhook url> <channel id> <bot token> --server <URL>\n ```\n * Prerequisites:\n * You need to run server beforehand. As an example using CI/CD tools like Jenkins or GitHub Actions\n\n---\n* Run tests with failed tests counter. By running below command you will get JSON file with percentage of failed tests:\n ```\n pytest --junitxml=result.xml -o junit_family=\"xunit1\" --pyreport --failed-tests-count\n ```\n * Fail percentage formula:\n ```text\n Failed Tests Percentage = (Number of Failed Tests / Total Number of Tests) * 100\n = (10 / 100) * 100\n = 10%\n ```\n * Example `fail_percentage.json`:\n ```json\n {\"fail_count\": 10, \"fail_percentage\": 10.0}\n ```\n \n\n## Test results\n* Once test run completed you should see `pyreport.html` file that auto generated by using above commands. \\\nOpen it and check the test results as shown in below presentation\n\n\n\n## Presentation\n![pyreport](https://toghrulmirzayev.github.io/pytest-pyreport/presentation.gif)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "PyReport is a lightweight reporting plugin for Pytest that provides concise HTML report",
"version": "1.6.0",
"project_urls": {
"Homepage": "https://github.com/ToghrulMirzayev/pytest-pyreport"
},
"split_keywords": [
"pytest_pyreport",
" python",
" pytest",
" report",
" slack",
" telegram",
" messenger",
" pyreport"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a7127c6659ef6586bf8abb14632fcd527cb854b4147d96f11bc1b8e3ad1df152",
"md5": "b29291204857f2c09632f94f8c1699a3",
"sha256": "81cb2980e9ab7b7f8a18822282cb5f34e6b1f6e939cde459c6d07ea568c9e6db"
},
"downloads": -1,
"filename": "pytest_pyreport-1.6.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b29291204857f2c09632f94f8c1699a3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 11548,
"upload_time": "2024-05-05T20:00:03",
"upload_time_iso_8601": "2024-05-05T20:00:03.405275Z",
"url": "https://files.pythonhosted.org/packages/a7/12/7c6659ef6586bf8abb14632fcd527cb854b4147d96f11bc1b8e3ad1df152/pytest_pyreport-1.6.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "69b17a5072f06bf19cfdf98e58b3228630cdf8759baaacef710ac7e67eedbe57",
"md5": "de4873fb5b72d4e58d01bd8bf8e7c482",
"sha256": "fed4bb9af9ea3838a9b83f549fddd740fd06f9822050d9739b05acc68289e615"
},
"downloads": -1,
"filename": "pytest_pyreport-1.6.0.tar.gz",
"has_sig": false,
"md5_digest": "de4873fb5b72d4e58d01bd8bf8e7c482",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 12345,
"upload_time": "2024-05-05T20:00:05",
"upload_time_iso_8601": "2024-05-05T20:00:05.655684Z",
"url": "https://files.pythonhosted.org/packages/69/b1/7a5072f06bf19cfdf98e58b3228630cdf8759baaacef710ac7e67eedbe57/pytest_pyreport-1.6.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-05 20:00:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ToghrulMirzayev",
"github_project": "pytest-pyreport",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "pytest-pyreport"
}