Skip to content

About

Ready-to-use OpenAPI Test coverage analysis tool that helps teams improve integration

lint

CoveAPI is an advanced test coverage analysis tool based on the OpenAPI standard. It offers a comprehensive solution for teams to effectively measure and improve their integration test coverage within CI/CD pipelines.

With CoveAPI, teams can easily establish and enforce specific coverage thresholds, ensuring that critical parts of their application are thoroughly tested. By integrating CoveAPI into their existing CI/CD workflows, teams can automatically track and monitor test coverage metrics, making it easier to identify areas that require additional testing.

Attention

CoveAPI does not support OpenAPI 3.x yet, but it will be supported in the future.

Installation

You can use the Github Action to integrate CoveAPI into your CI/CD pipeline. See Usage for more details, or you can find it in Marketplace CoveAPI

Usage

Prerequisites

The following components are needed to get started using CoveAPI:

  1. A REST-based Web Application (e.g., a REST API using FastAPI)
  2. An OpenAPI or Swagger specification for your application (e.g., docs/swagger.yaml)
  3. API integration tests in your CI/CD pipeline (e.g., pytest)

Note

CoveAPI Support all the Languages that have a OpenAPI or Swagger Specification

Integrate CoveAPI into your CI/CD pipeline

Direct your integration tests towards the CoveAPI reverse proxy to enable analysis and interpretation of requests that occur during the testing process. This ensures that CoveAPI effectively handles requests during integration testing.

Configure your tests to target either http://localhost:13750 (without Docker) or http://coveapi:13750 (with Docker). If you are using Docker, CoveAPI will automatically set up the networking for your container to establish a connection with it.

Setup Preparation Stage

To ensure CoveAPI is properly configured for later use, follow these steps. Place this preparation stage after starting your service and before running your integration tests.

Please remember to replace the location of your OpenAPI spec and the instance URL. You can provide the OpenAPI spec as either a local file path or a URL.

- name: Initialize CoveAPI
  uses: yezz123/coveapi@2.1.0
  with:
    stage: "preparation"
    openapi-source: "docs/swagger.json"
    instance-url: "http://localhost:8080"
    test-coverage: "75%"

Make sure to modify the openapi-source parameter to point to the location of your OpenAPI or Swagger specification. This can be either a local file path or a URL.

Similarly, adjust the instance-url parameter to match the base URL of your service, excluding the base path specified in your OpenAPI spec.

Optionally, you can set a desired test-coverage value for your endpoints.

By following these steps, CoveAPI will be properly prepared for integration testing, ensuring accurate analysis and interpretation of requests.

Setup Evaluation Stage

Place the CoveAPI evaluation stage somewhere after your integration tests have run.

  - uses: yezz123/coveapi@2.1.0
    name: Evaluate CoveAPI
    with:
      stage: "evaluation"

This stage will fail if test coverage isn't met and can display additional information gathered during the integration tests.

Contributing

For guidance on setting up a development environment and how to make a contribution to CoveAPI, see Contributing to CoveAPI.

Reporting a Security Vulnerability

See our security policy.