Skip to content

FAQ

Short answers to common questions about ReqCover, with links to the reference pages.

The BSD 3-Clause License; see LICENSE. You can use ReqCover in commercial and closed-source projects.

No. ReqCover is published only to GitHub Packages at https://maven.pkg.github.com/reqcover/reqcover. GitHub Packages requires authentication even for public packages: use your GitHub username and a personal access token with the read:packages scope. See Installation.

JUnit Jupiter 5 and 6 (reqcover-engine-junit-jupiter; on JUnit 5 use 0.0.12 or later), TestNG (reqcover-engine-testng, since 0.0.10) and Cucumber 7 and 8, tested with 7.31.0 and 8.0.4 (reqcover-engine-cucumber, since 0.0.11). See the guides for JUnit, TestNG and Cucumber.

Any JVM language whose tests run on one of these frameworks. ReqCover is tested with Java and Kotlin; Scala and Groovy should work the same way but are not tested. @ForRequirement is a regular runtime annotation (dev.reqcover.api.ForRequirement) with one attribute, id.

Why does @ForRequirement("#getUsers/200") not compile in Java?

Section titled “Why does @ForRequirement("#getUsers/200") not compile in Java?”

The annotation is written in Kotlin, and its attribute is called id, not value. Java’s short form only works for an attribute named value. Name the attribute in Java (and in Groovy and Scala):

@Test
@ForRequirement(id = "#getUsers/200")
void listsUsers() { }

Kotlin allows the short form:

@Test
@ForRequirement("#getUsers/200")
fun `lists users`() { }

Yes. @ForRequirement is repeatable; put several on one test. In Cucumber, add several @req: tags.

Can I put @ForRequirement on a test class?

Section titled “Can I put @ForRequirement on a test class?”

Yes, since 0.0.12, for JUnit and TestNG: the requirement is covered when at least one test in the class passes.

A requirement is covered when at least one test linked to it passes. For parameterized, repeated and data-provider tests and for dynamic tests of a @TestFactory, one passing run is enough. Failing, skipped and aborted runs do not count. See Core concepts.

Does ReqCover replace code coverage tools like JaCoCo?

Section titled “Does ReqCover replace code coverage tools like JaCoCo?”

No. Code coverage measures which lines your tests execute. ReqCover measures which requirements are verified by a passing test. They complement each other.

Yes. Since 0.0.10 the coverage tracker is thread-safe; earlier versions could lose requirements in parallel runs (#69).

What happens if no requirements are configured?

Section titled “What happens if no requirements are configured?”

If reqCover.requirementsUris is not set or empty, ReqCover logs a warning (ReqCover is on the classpath, but no requirements specification has been provided.) and does not check coverage. See Configuration.

What happens if a requirements file is missing or broken?

Section titled “What happens if a requirements file is missing or broken?”

The build fails before tests run (since 0.0.10; with TestNG, before the tests of the suite that lists the file). See Troubleshooting.

What if a test names a requirement that is not in the requirements file?

Section titled “What if a test names a requirement that is not in the requirements file?”

The test still runs normally. ReqCover logs The following covered requirements are not defined in the requirements specification: [...] and lists the ID as unexpected in the reports. It does not count towards coverage.

No. reqcover-source-openapi is the source ReqCover ships, but you can write your own. See Requirements sources.

Does the build fail if coverage is too low?

Section titled “Does the build fail if coverage is too low?”

Only if you set reqCover.minimumRequiredCoveragePercent (default 0.0). Set reqCover.failIfBelowMinimum=false to only log the shortfall. The reports are written before the build fails.

In build/reports/tests/reqcover by default, or in reqCover.reportsDir.