Configuration
This page lists every ReqCover setting, its default, and where each test framework reads it from.
Overview
Section titled “Overview”| 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.
reqCover.requirementsUris
Section titled “reqCover.requirementsUris”The requirements specifications that define which requirements are expected.
- Type: comma-separated list of classpath resource locations, for example
requirements.yamlorapi/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.
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%). |
reqCover.minimumRequiredCoveragePercent
Section titled “reqCover.minimumRequiredCoveragePercent”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=100reqCover.failIfBelowMinimum
Section titled “reqCover.failIfBelowMinimum”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=falsereqCover.reportsDir
Section titled “reqCover.reportsDir”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):
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/.
<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>reqCover.cucumber.tagPrefix
Section titled “reqCover.cucumber.tagPrefix”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.
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.
reqCover.requirementsUri (removed)
Section titled “reqCover.requirementsUri (removed)”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.Precedence
Section titled “Precedence”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.
JUnit Jupiter
Section titled “JUnit Jupiter”| 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 |
reqCover.requirementsUris=requirements.yamlreqCover.minimumRequiredCoveragePercent=100TestNG
Section titled “TestNG”| Order | Source |
|---|---|
| 1 | JVM system property |
| 2 | testng.xml suite <parameter> |
| 3 | Built-in default |
<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. |
Cucumber
Section titled “Cucumber”| 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 |
cucumber.plugin=dev.reqcover.cucumber.RequirementsCoverageListenerreqCover.requirementsUris=requirements.yamlreqCover.minimumRequiredCoveragePercent=100Next steps
Section titled “Next steps”- Requirements sources: what to put in the files named by
reqCover.requirementsUris. - Reporters: what is written to
reqCover.reportsDir. - Troubleshooting: log messages and how to fix them.
- Framework guides: JUnit, TestNG, Cucumber, Maven.