Newv0.0.12 is out — JUnit 5 works again 🎉
ReqCover

Requirements coverage for JVM tests

Every requirement, proven by a passing test.

ReqCover links your JUnit, TestNG and Cucumber tests to the requirements in your API spec, reports what is covered, and fails the build when coverage falls short - for Java, Kotlin and other JVM languages.

Open source (BSD-3-Clause) · Gradle & Maven · Latest v0.0.12

Example ReqCover result: 3 of 4 requirements covered, 75.0%, and the build fails because the minimum is 100.0%.

How it works

Three steps from spec to coverage gate

  1. Describe your requirements

    Your OpenAPI spec already lists them: each operationId and response is a requirement. Add more with x-requirements.

    operationId: getUsers
    responses:
      "200": ...   # → #getUsers/200
  2. Tag your tests

    Annotate a test with @ForRequirement, or tag a Cucumber scenario with@req:.

    // Java
    @ForRequirement(id = "#getUsers/200")
    // Kotlin
    @ForRequirement("#getUsers/200")
    # Gherkin
    @req:#getUsers/200
  3. Run your build

    Run your tests as usual. ReqCover writes the report and checks the coverage gate.

    $ ./gradlew test
    All requirements are covered by tests.
    Requirements coverage: 4 out of 4 = 100.0%

Test frameworks

Works with your test framework

Use JUnit Jupiter, TestNG or Cucumber. The JUnit and TestNG listeners register themselves automatically; for Cucumber you add one line, cucumber.plugin. Only passing tests count as covering a requirement.

Requirements sources

Requirements from your API spec

Point ReqCover at an OpenAPI document and every operationId and response becomes a requirement, extended with x-requirements where you need finer detail. Other formats plug in through the RequirementsSource SPI.

Coverage gate

A coverage gate in CI

Set reqCover.minimumRequiredCoveragePercent and the build fails when coverage drops below it. Prefer a warning? Set reqCover.failIfBelowMinimum=false. The report is written first, so you can see what is missing.

Reports

HTML and XML reports

Add the HTML and XML reporters to get a readable report for people and a machine-readable one for tools. Reports go to build/reports/tests/reqcover; change it with reqCover.reportsDir, for example to target/ on Maven.

Build tools

Gradle and Maven

ReqCover is a set of test dependencies, not a build plugin, so it works the same in Gradle and Maven. Configure it through system properties, junit-platform.properties, testng.xml or cucumber.properties.

Quick install

Add ReqCover to your build

ReqCover is published to GitHub Packages, which needs a GitHub token with read:packages. Using TestNG or Cucumber? Swap the engine for reqcover-engine-testng or reqcover-engine-cucumber.

Gradle (Kotlin DSL) · build.gradle.kts

repositories {
    mavenCentral()
    maven("https://maven.pkg.github.com/reqcover/reqcover") {
        credentials {
            username = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_ACTOR")
            password = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN")
        }
    }
}

dependencies {
    testImplementation("dev.reqcover:reqcover-engine-junit-jupiter:0.0.12")
    testImplementation("dev.reqcover:reqcover-source-openapi:0.0.12")
    testImplementation("dev.reqcover:reqcover-reporter-html:0.0.12")
}

Maven · pom.xml

<repositories>
  <repository>
    <id>github</id>
    <url>https://maven.pkg.github.com/reqcover/reqcover</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>dev.reqcover</groupId>
    <artifactId>reqcover-engine-junit-jupiter-jvm</artifactId>
    <version>0.0.12</version>
    <scope>test</scope>
  </dependency>
  <!-- plus reqcover-source-openapi-jvm, reqcover-reporter-html-jvm -->
</dependencies>

Next: Getting started walks through your first coverage report.

Open source

BSD 3-Clause licensed and developed in the open on GitHub. Issues, ideas and pull requests are welcome.

Sponsors

This project is sponsored by:

For AI agents

A plain-text summary of ReqCover and its docs for coding agents and LLMs lives at /llms.txt.