Metadata-Version: 2.4
Name: pytest-xhtml
Version: 0.5.0
Summary: pytest plugin for generating HTML reports
Project-URL: Homepage, https://github.com/seldomqa/pytest-xhtml
Project-URL: Source, https://github.com/seldomqa/pytest-xhtml
Project-URL: Tracker, https://github.com/seldomqa/pytest-xhtml/issues
Author-email: Henry Hu <defnngj@gmail.com>
License-Expression: MPL-2.0
License-File: LICENSE
Keywords: html,pytest,report
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Natural Language :: English
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Requires-Dist: jinja2>=3
Requires-Dist: pytest-metadata>=2
Requires-Dist: pytest>=7
Provides-Extra: docs
Requires-Dist: pip-tools>=6.13; extra == 'docs'
Provides-Extra: test
Requires-Dist: assertpy>=1.1; extra == 'test'
Requires-Dist: black>=22.1; extra == 'test'
Requires-Dist: flake8>=4.0.1; extra == 'test'
Requires-Dist: pre-commit>=2.17; extra == 'test'
Requires-Dist: pytest-playwright>=0.8.0; extra == 'test'
Requires-Dist: tox>=3.24.5; extra == 'test'
Description-Content-Type: text/markdown

# pytest-xhtml

![](./images/XReport_logo.png)

pytest-xhtml is a plugin for `pytest` that generates a HTML report for test results.

> ⚠️ **`pytest-xhtml` is the alternative library for `pytest-html`. If you have installed `pytest-html`, please uninstall it first.**

## install

```bash
# pip install
pip install pytest-xhtml
```

## usage

* unit test

```bash
cd testing_unit
pytest test_sample.py --html=report.html
```

![unit test](./images/unit_report_0.4.0.png)

* e2e test

```bash
# install playwright library
pip install pytest-playwright
playwright install chromium

cd testing_e2e
pytest test_playwright.py --html=report.html
```

![e2e test](./images/e2e_report_0.4.0.png)

* http test

```bash
# install pytest-req library
pip install pytest-req

cd testing_req
pytest test_req.py --html=report.html
```

![http test](./images/http_report_0.4.0.png)


## VS pytest-html

pytest-xhtml is fully compatible with pytest-html. The only difference is a more beautiful UI style.

| Feature | pytest-html | pytest-xhtml |
|---|---|---|
| UI Style | Traditional table layout | ✨ Modern card-based dashboard (More beautiful!) |
| Generate HTML Report | `pytest --html=report.html` | 🟰 |
| Self-contained Report | `pytest --html=report.html --self-contained-html` | 🟰 |
| Custom CSS | `pytest --html=report.html --css=style.css` | 🟰 |
| Report Streaming | `generate_report_on_test = true` (pytest.ini) | 🟰 |
| Environment Redaction | `environment_table_redact_list` (regex) | 🟰 |
| Collapsed Rows | `render_collapsed = passed,failed` (pytest.ini) | 🟰 |
| Initial Sort | `initial_sort = result` (pytest.ini) | 🟰 |
| Hook: Report Title | `pytest_html_report_title(report)` | 🟰 (rename to `pytest_xhtml_*`) |
| Hook: Results Summary | `pytest_html_results_summary(prefix, summary, postfix)` | 🟰 (rename to `pytest_xhtml_*`) |
| Hook: Table Header | `pytest_html_results_table_header(cells)` | 🟰 (rename to `pytest_xhtml_*`) |
| Hook: Table Row | `pytest_html_results_table_row(report, cells)` | 🟰 (rename to `pytest_xhtml_*`) |
| Hook: Table HTML | `pytest_html_results_table_html(report, data)` | 🟰 (rename to `pytest_xhtml_*`) |
| Hook: Duration Format | `pytest_html_duration_format(duration)` | 🟰 (rename to `pytest_xhtml_*`) |
| Extras: HTML | `extras.html('<div>...</div>')` | 🟰 |
| Extras: JSON | `extras.json({'name': 'pytest'})` | 🟰 |
| Extras: Text | `extras.text('some text')` | 🟰 |
| Extras: URL | `extras.url('http://example.com/')` | 🟰 |
| Extras: Image | `extras.image(path_or_data, mime_type, ext)` | 🟰 |
| Extras: PNG/JPG/SVG | `extras.png()` / `extras.jpg()` / `extras.svg()` | 🟰 |
| Extras Fixture | `def test_x(extras):` | 🟰 |
| ANSI Code Support | Via `ansi2html` (optional) | 🟰 |


## Develop

```bash
# develop 
git clone https://github.com/seldomQA/pytest-xhtml.git
cd pytest-xhtml
pip install .
```