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
  • e2e test
# install playwright library
pip install pytest-playwright
playwright install chromium

cd testing_e2e
pytest test_playwright.py --html=report.html
  • http test
# install pytest-req library
pip install pytest-req

cd testing_req
pytest test_req.py --html=report.html
  • HTML Report

html report

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.1

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.1
File Size Uploaded
pytest_xhtml-0.6.1.tar.gz 5.2 MB Details

Built distribution (wheel)

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

Total release size: 5.3 MB

Release files / pytest_xhtml-0.6.1.tar.gz

Download URL pytest_xhtml-0.6.1.tar.gz
Size 5.2 MB
Tags Source
SHA-256 checksum
How to use checksums
87e6c29aa419e9d091d4ac17de8fd519926a66490f7fc48b98d0be019f328546
BLAKE2b-256 checksum
How to use checksums
cea071df4b83d2b90e5fa433f958f70c885d14b42107c28221ff23a595b06175
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

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

Download URL pytest_xhtml-0.6.1-py3-none-any.whl
Size 35.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afef0741b3a2d368ea910769fe0fa536b302ddb50232c84d5385b61e81011f58
BLAKE2b-256 checksum
How to use checksums
0c404f54c6d95ac173d8cb47ea255bf71732ca70008d6a823336268ff4468258
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files

0.6.0

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