Pytest JSON CTRF Reporter

0.3.6 · active · verified Sun Mar 29

pytest-json-ctrf is a pytest plugin that generates test reports in the Common Test Report Format (CTRF) as a JSON file. This standard format allows for consistent reporting across various testing tools and frameworks, facilitating better analysis and integration with external systems like GitHub Actions for prettifying reports. The current version is 0.3.6, with releases tied to pytest compatibility and feature enhancements.

Warnings

Install

Quickstart

First, create a simple test file (e.g., `test_example.py`). Then, run pytest from your terminal, specifying the `--ctrf` flag followed by the desired output filename. This will generate a JSON report in the Common Test Report Format in the specified file.

import pytest

# tests/test_example.py
def test_passing_example():
    assert True

def test_failing_example():
    assert False

# To run and generate report:
# pytest --ctrf report.json
# cat report.json

view raw JSON →