Skip to main content

Pytest plugin to generate json report in CTRF (Common Test Report Format)

Project description

CTRF 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
  • Parametrized tests are supported and reported as 1 test with multiple retries

Installation

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

Json exampe

More info here: https://ctrf.io/docs/schema/examples

{
  "results": {
    "tool": {
      "name": "jest"
    },
    "summary": {
      "tests": 3,
      "passed": 1,
      "failed": 1,
      "pending": 0,
      "skipped": 1,
      "other": 0,
      "start": 1706644023,
      "stop": 1706644043
    },
    "tests": [
      {
        "name": "User should be able to login",
        "status": "passed",
        "duration": 1200
      },
      {
        "name": "User profile information should be correct",
        "status": "failed",
        "duration": 800
      },
      {
        "name": "User should be able to logout",
        "status": "skipped",
        "duration": 0
      }
    ]
  }
}

Report Example

Example Image

Credits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_json_ctrf-0.1.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

pytest_json_ctrf-0.1.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file pytest_json_ctrf-0.1.2.tar.gz.

File metadata

  • Download URL: pytest_json_ctrf-0.1.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pytest_json_ctrf-0.1.2.tar.gz
Algorithm Hash digest
SHA256 84f786326cca5ee5b73afb77d112215fb416296bd84caa82a5c91d5dae3bbc28
MD5 e881d5e268f2c7f183f46313f1608668
BLAKE2b-256 c44faeb547b0a404c2180d20a2fa043fb8b0797c40befbdee6dcaca90a85c01a

See more details on using hashes here.

File details

Details for the file pytest_json_ctrf-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_json_ctrf-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f8a6532351aed1da3609b5f23b5ee7dc63c3379585d6f7cfa045835a13588253
MD5 a153f9fa2a641882fb8d7ec254907658
BLAKE2b-256 f4d7e019fad63927e72d87e04ebac5f6a69a1d5d53ba8a56b371ee8ba1442729

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page