Skip to main content

Compute and report coverage over a modeled test universe

Project description

Coverage Universe

CI Release PyPI Codecov

Compute and report coverage over a modeled test universe. Turn a domain model (UDL) into atomic coverage targets, ingest test runs, compute coverage (including pairwise and numeric boundaries), and render reports.

Features

  • UDL normalization for enum/number parameters with partitions and optional boundaries
  • Atom generation: partitions, numeric boundary atoms, and t2/t3 (pairwise/3-wise) atoms with simple constraints filtering
  • Coverage mapping per test, totals by kind, and weighted metrics
  • Optional filters: only passing or only failing tests
  • Configurable numeric boundary epsilon
  • Per-parameter and per-tag breakdowns
  • HTML report and JSON output
  • Optional JSON Schema validation for UDL and run inputs

Installation

  • Editable install (recommended for development):
    • pip install -e .
  • Optional (enables schema validation):
    • pip install jsonschema

Quick Start

  1. Build atoms from a UDL JSON
  • coverage-universe build-universe --udl examples/udl_example.json --out examples/atoms.json --validate
  1. Ingest a test run
  • coverage-universe ingest --run examples/run_example.json --out examples/run.norm.json --validate
  1. Compute coverage
  • coverage-universe compute --atoms examples/atoms.json --evidence examples/run.norm.json --out examples/coverage.json --only-passing
  1. Render report
  • coverage-universe report --coverage examples/coverage.json --html examples/coverage.html

Open examples/coverage.html in a browser.

CLI Reference

  • build-universe

    • --udl PATH (required): UDL JSON
    • --out PATH (required): Output atoms bundle JSON
    • --validate (optional): Validate UDL against schema (needs jsonschema)
  • ingest

    • --run PATH (required): Test run JSON
    • --out PATH (required): Output normalized run JSON
    • --validate (optional): Validate run against schema (needs jsonschema)
  • compute

    • --atoms PATH (required): Atoms bundle from build-universe
    • --evidence PATH (required): Ingested run JSON
    • --out PATH (required): Coverage JSON output
    • --only-passing (optional): Use only passing tests
    • --only-failing (optional): Use only failing tests (mutually exclusive with --only-passing)
    • --boundary-eps FLOAT (optional): Epsilon for numeric boundary hits (default 1e-9)
  • report

    • --coverage PATH (required): Coverage JSON
    • --html PATH (optional): Write HTML report to this path; if omitted, prints JSON to stdout

Data Formats

  • UDL JSON (see example examples/udl_example.json and schema schemas/udl.schema.json)

    • Parameters:
      • enum: { "name": ..., "type": "enum", "partitions": [{"value": ... , "weight": 1.0}] }
      • number: { "name": ..., "type": "number", "partitions": [{"range": [min, max], "class": "label", "weight": 1.0}], "boundary": {"include": ["min","max","just-inside","just-outside"]}}
    • Optional: constraints: basic if/then objects (MVP equality / not-equals)
  • coverage: { "t_wise": 0|2|3, "include_boundary": true|false }

  • Run JSON (see example examples/run_example.json and schema schemas/run.schema.json)

    • { "run_id": "...", "tests": [{ "test_id": "...", "outcome": "passed|failed|skipped|...", "inputs": { param: value, ... } }] }

Coverage Output (JSON)

Top-level keys include:

  • totals: by kind (partition, t2, boundary) with covered/total and weighted sums
  • covered_count, total_atoms, top_uncovered
  • per_test: mapping per test with covered atoms and chosen partitions
  • by_parameter: per-parameter partition and boundary summaries and uncovered partition atoms
  • by_tag: partition summaries aggregated by parameter tag
  • outcomes: counts per outcome category; tests_total, tests_considered, filter, boundary_eps

Examples

  • Example UDL: examples/udl_example.json
  • Example runs: examples/run_example.json, examples/run_example_eps.json
  • Generated outputs: coverage JSON/HTML variants under examples/

Development

  • Code lives under the coverage_universe package (this directory)
  • Optional validators: pip install jsonschema
  • Packaging: pyproject.toml defines an entry point coverage-universe
  • Ignored artifacts: see .gitignore

Notes

  • Numeric boundary hits are exact by default. Use --boundary-eps to match values within ±epsilon of min/max and their just-inside/outside heuristics.
  • Pairwise atoms (T2) consider simple constraints to drop contradictory combinations.

License

Apache-2.0. See LICENSE for details.

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

coverage_universe-0.1.5.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

coverage_universe-0.1.5-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file coverage_universe-0.1.5.tar.gz.

File metadata

  • Download URL: coverage_universe-0.1.5.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for coverage_universe-0.1.5.tar.gz
Algorithm Hash digest
SHA256 ce64169d2372b8f3f7c5cfed6c552e210ac03010ac8de30d4841677ad329f05b
MD5 88ccf3f206eb175282c5fc32c434a0e9
BLAKE2b-256 ebfefa70ba7a87061e1e1369edba4f280ccbc95407afc3cc3ea18fd851e95049

See more details on using hashes here.

File details

Details for the file coverage_universe-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for coverage_universe-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5d686cbe885cb1eacd1ca31daf6804fa2154d31f1d16c6281c080307e34935db
MD5 74e047a0d62db601b591f52fc459ae84
BLAKE2b-256 6885c16fbc209d1686c3bddeee835ee6691c816e02822a17751ad2adb7097180

See more details on using hashes here.

Supported by

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