Skip to main content

pytest-xhtml

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

# pip install
pip install pytest-xhtml

usage

  • unit test
cd testing_unit
pytest test_sample.py --html=report.html

unit test

  • e2e test
# install playwright library
pip install pytest-playwright
playwright install chromium

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

e2e test

  • http test
# install pytest-req library
pip install pytest-req

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

http test

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

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

Metadata

Release files for pytest-xhtml 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-xhtml 0.6.0
File Size Uploaded
pytest_xhtml-0.6.0.tar.gz 4.7 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-xhtml 0.6.0
File Interpreter ABI Platform
pytest_xhtml-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.7 MB

Release files / pytest_xhtml-0.6.0.tar.gz

Download URL pytest_xhtml-0.6.0.tar.gz
Size 4.7 MB
Tags Source
SHA-256 checksum
How to use checksums
598dcd642aa5efd4c732315a8b07feb92a04d7ea574ea4159cef5afd797b5cc8
BLAKE2b-256 checksum
How to use checksums
d7cad9b5ab32d880bc1190f62733754b5b1e512887e36873aaa3f5f082ada65d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / pytest_xhtml-0.6.0-py3-none-any.whl

Download URL pytest_xhtml-0.6.0-py3-none-any.whl
Size 35.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd339f3f37984f5620dcb8cec32a97a5567288e27582fa446c6f51d98f82b8d2
BLAKE2b-256 checksum
How to use checksums
d6c1a5b8508dde1d54fe90f9aeab8b58093bd0d41978e0a8ebf6c2925dc3743c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

0.6.1

2 release files

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page