pytest-excel

1.8.1 · active · verified Thu Apr 16

pytest-excel is a plugin for pytest that enables the generation of detailed Excel reports from test results. Currently at version 1.8.1, the library maintains an active development status with regular updates, including recent support for Python 3.11+.

Common errors

Warnings

Install

Quickstart

Install the plugin, then run your pytest tests from the command line, specifying the `--excelreport` option with a desired filename. The plugin automatically integrates with pytest's test discovery and execution. Use `--collect-only` to generate a report with test names and docstrings without actual execution.

# 1. Create a simple test file (e.g., test_example.py)
# def test_addition():
#     assert 1 + 1 == 2

# 2. Run pytest with the --excelreport option
#    The report will be generated as 'report.xls' or specified name.
#    Use %Y-%M-dT%H% for a timestamped filename.

# To run all tests and generate a report:
# pytest --excelreport=report.xls

# To get a verbose output and generate a report:
# pytest -v --excelreport=report.xls

# To collect tests without execution and generate a report showing docstrings:
# pytest --excelreport=report.xls --collect-only

# Example with timestamped filename:
pytest --excelreport=report_%Y-%m-%dT%H%M.xls

view raw JSON →