Pytest plugin to generate json report in CTRF (Common Test Report Format)
Maintained. Last release 3 weeks ago, commits in 0 of the last 26 weeks. Weaker on commit activity and contributor spread.
pip install pytest-json-ctrfCTRF for pytest
Pytest implementation of Common Test Report Format (CTRF) for test results.
Test report will be generated in JSON format.
Test report can be used to prettify the report in GitHub Actions with github-actions-ctrf.
Do not worry if report in GitHub does not appear immediately. It takes some time to process the report.
Features
- Generates JSON report
- Tested to work correctly with and without pytest-xdist
- Tested to get browser name from pytest-playwright
- Reruns from pytest-rerunfailures are reported as
retries,retryAttemptsandflaky - Each test gets a
suitehierarchy: file, then classes - Parametrized tests are supported: each case is reported as a separate test named by its full pytest node id (e.g.
test_file.py::test_param[1]), with its values inparameters
Installation
Requires Python 3.9+ and pytest 7.4+.
pip install pytest-json-ctrf
Usage
generate report.json file in the root directory of the project. File path is mandatory
pytest --ctrf report.json
Environment Variables may be used to specify the required Environment Object fields when using the CTRF slack-test-reporter. All of them are optional: a variable that is not set is left out of the report, see .env.example.
CTRF_BUILD_NAME="Pytest JSON CTRF Report"
CTRF_BUILD_NUMBER=123
CTRF_BUILD_URL="https://ctrf.io"
CTRF_TEST_ENVIRONMENT="staging"
CTRF_TEST_TYPE="e2e"
CTRF_BUILD_NUMBER must be an integer. Otherwise a warning is issued and buildNumber is omitted from the report.
osPlatform, osRelease and osVersion are detected automatically.
CTRF_TEST_TYPE is written to every test's type field.
