Skip to content

Configuration

This page lists every ReqCover setting, its default, and where each test framework reads it from.

Setting Type Default Frameworks
reqCover.requirementsUris Comma-separated list of classpath locations none (a warning is logged, coverage is not checked) JUnit, TestNG, Cucumber
reqCover.minimumRequiredCoveragePercent Decimal number (percent) 0.0 JUnit, TestNG, Cucumber
reqCover.failIfBelowMinimum Boolean true JUnit, TestNG, Cucumber
reqCover.reportsDir Directory path build/reports/tests/reqcover JUnit, TestNG, Cucumber
reqCover.cucumber.tagPrefix String @req: Cucumber
reqCover.requirementsUri Removed in 0.0.10 - -

Every setting is a plain key-value pair. Where you put it depends on the framework; see Precedence.

The requirements specifications that define which requirements are expected.

  • Type: comma-separated list of classpath resource locations, for example requirements.yaml or api/users.yaml, api/orders.yaml.
  • Default: none.
  • Frameworks: JUnit Jupiter, TestNG, Cucumber.

Each entry is trimmed; empty entries are ignored. Locations are resolved with the test class loader, so a file in src/test/resources/api/users.yaml is written as api/users.yaml (no leading slash). If the same location exists in several classpath entries (for example in several JARs), all of them are read. See Requirements sources.

src/test/resources/junit-platform.properties
reqCover.requirementsUris=api/users.yaml, api/orders.yaml
Value Behaviour
Not set, empty, or only commas and spaces Warning ReqCover is on the classpath, but no requirements specification has been provided. Coverage is not checked.
A location that does not exist Error Requirements file not found at URI: <uri>, the build fails.
A malformed file or a file in an unsupported format Error Unsupported format for requirements file at URI: <uri>, the build fails.
A valid file without requirements Warning Requirements file at URI: <uri> contains no requirements., the file adds no requirements (if no file adds any, coverage is reported as 100%).

The minimum requirements coverage, in percent, that the test run must reach.

  • Type: decimal number, for example 100, 80, 92.5.
  • Default: 0.0.
  • Frameworks: JUnit Jupiter, TestNG, Cucumber.

Coverage is covered requirements / expected requirements * 100. With no expected requirements, coverage is 100.0. If coverage is below the minimum, ReqCover logs Requirements coverage is below the minimum required coverage of <minimum>%. Actual coverage: <coverage>% and, if reqCover.failIfBelowMinimum is true, fails the build.

reqCover.minimumRequiredCoveragePercent=100

Whether the build fails when coverage is below the minimum.

  • Type: boolean.
  • Default: true.
  • Frameworks: JUnit Jupiter, TestNG, Cucumber.

With false, ReqCover still logs the error message about insufficient coverage and still writes the reports, but the build continues. With true, ReqCover additionally logs Exiting with error code 1 due to insufficient requirements coverage. and ends the JVM with exit code 1.

reqCover.failIfBelowMinimum=false

The directory into which the reporters write their files.

  • Type: directory path, relative to the working directory of the test JVM or absolute.
  • Default: build/reports/tests/reqcover.
  • Frameworks: JUnit Jupiter, TestNG, Cucumber. Since 0.0.11.

The directory is created if it does not exist. The HTML reporter writes requirements-coverage.html, the XML reporter writes requirements-coverage.xml. See Reporters.

Gradle (Kotlin DSL):

build.gradle.kts
tasks.test {
systemProperty("reqCover.reportsDir", layout.buildDirectory.dir("reports/reqcover").get().asFile.path)
}

Maven: set it so the reports go to target/ instead of build/.

pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<reqCover.reportsDir>${project.build.directory}/reqcover</reqCover.reportsDir>
</systemPropertyVariables>
</configuration>
</plugin>

The prefix of Cucumber tags that name a requirement.

  • Type: string.
  • Default: @req:.
  • Frameworks: Cucumber only. Since 0.0.11.

A passing scenario covers every requirement whose tag starts with this prefix; the rest of the tag is the requirement ID. With the default, @req:#getUsers/200 covers #getUsers/200. Tags on a feature or rule apply to all its scenarios.

src/test/resources/cucumber.properties
reqCover.cucumber.tagPrefix=@requirement:

The prefix includes the @ of the tag. Tags that do not start with the prefix are ignored. See the Cucumber guide.

The singular reqCover.requirementsUri was removed in 0.0.10. Use reqCover.requirementsUris.

With JUnit Jupiter, a configured reqCover.requirementsUri (as system property or JUnit configuration parameter) fails the build with:

The reqCover.requirementsUri configuration parameter has been removed. Use reqCover.requirementsUris instead.

Each setting is looked up in the sources below, in order; the first source that sets it wins. A source wins even if its value is empty.

Order Source
1 JVM system property (-DreqCover.…, Gradle systemProperty(...), Maven <systemPropertyVariables>)
2 JUnit configuration parameter (src/test/resources/junit-platform.properties, launcher or build tool configuration)
3 Built-in default
src/test/resources/junit-platform.properties
reqCover.requirementsUris=requirements.yaml
reqCover.minimumRequiredCoveragePercent=100
Order Source
1 JVM system property
2 testng.xml suite <parameter>
3 Built-in default
testng.xml
<suite name="My suite">
<parameter name="reqCover.requirementsUris" value="requirements.yaml"/>
<parameter name="reqCover.minimumRequiredCoveragePercent" value="100"/>
</suite>

With several suites in one run:

Setting Rule
reqCover.requirementsUris The URIs of all suites are combined; each URI is loaded once.
reqCover.minimumRequiredCoveragePercent The highest minimum of all suites applies.
reqCover.failIfBelowMinimum The build fails if any suite asks for it. A suite that does not set it counts as true.
reqCover.reportsDir Taken from the first suite that sets it.
Order Source
1 JVM system property
2 cucumber.properties on the test classpath
3 junit-platform.properties on the test classpath
4 Built-in default
src/test/resources/cucumber.properties
cucumber.plugin=dev.reqcover.cucumber.RequirementsCoverageListener
reqCover.requirementsUris=requirements.yaml
reqCover.minimumRequiredCoveragePercent=100