Troubleshooting
This page maps symptoms and log messages to their cause and fix.
“No reporter configured”
Section titled ““No reporter configured””No reporter configured. Please add a RequirementsCoverageReporter implementation to the classpath.Cause: no reporter module is on the test classpath. Coverage is still checked, but no report file is written.
Fix: add reqcover-reporter-html and/or reqcover-reporter-xml (Maven: -jvm suffix) as test dependencies. See Reporters.
“Requirements file not found at URI”
Section titled ““Requirements file not found at URI””Requirements file not found at URI: requirements.yaml. Check the reqCover.requirementsUris configuration parameter.The second sentence differs by framework (...system property or testng.xml suite parameter. for TestNG, ...system property, cucumber.properties or junit-platform.properties setting. for Cucumber).
Cause: the location in reqCover.requirementsUris is not on the test classpath. The build fails.
Fix: put the file under src/test/resources (or another test resource directory) and use the path relative to it, without a leading /: src/test/resources/api/users.yaml is api/users.yaml. See Classpath locations.
“Unsupported format for requirements file at URI”
Section titled ““Unsupported format for requirements file at URI””Unsupported format for requirements file at URI: requirements.yaml. Check the reqCover.requirementsUris configuration parameter.Cause: the file was found, but no requirements source could read it: malformed YAML, an empty file, a YAML document without paths, or no source module on the classpath. The build fails.
Fix: validate the file as OpenAPI, and make sure reqcover-source-openapi is a test dependency.
“contains no requirements”
Section titled ““contains no requirements””Requirements file at URI: requirements.yaml contains no requirements. Check the reqCover.requirementsUris configuration parameter.Cause: the file is valid but has no operations with an operationId (for example paths: {}). This is a warning; the file adds no requirements (if no file adds any, coverage is reported as 100%).
Fix: add operationId to each operation. Operations without one are reported as Warning: Operation ID not found for path '...' and method '...'.
“no requirements specification has been provided”
Section titled ““no requirements specification has been provided””ReqCover is on the classpath, but no requirements specification has been provided.Cause: reqCover.requirementsUris is not set or empty where the framework reads it. Coverage is not checked.
Fix: set it in the right place for your framework; see Precedence. With Cucumber, a value in a properties file that is not on the test classpath is not seen.
“The reqCover.requirementsUri configuration parameter has been removed”
Section titled ““The reqCover.requirementsUri configuration parameter has been removed””The reqCover.requirementsUri configuration parameter has been removed. Use reqCover.requirementsUris instead.Cause: JUnit configuration still uses the singular key removed in 0.0.10. The JUnit build fails; TestNG and Cucumber ignore the old key.
Fix: rename the key to reqCover.requirementsUris in junit-platform.properties, your build file and CI scripts. See Upgrading.
401 Unauthorized when resolving dependencies
Section titled “401 Unauthorized when resolving dependencies”Cause: GitHub Packages requires authentication even for public packages. ReqCover is not on Maven Central.
Fix: use a personal access token with the read:packages scope.
- Gradle: set
gpr.userandgpr.keyin~/.gradle/gradle.properties, orGITHUB_ACTORandGITHUB_TOKENin the environment, and reference them in the repositorycredentialsblock. - Maven: add a
<server>with idgithub(the same id as the<repository>) to~/.m2/settings.xml.
See Installation.
Reports land in build/ under Maven
Section titled “Reports land in build/ under Maven”Cause: the default report directory is build/reports/tests/reqcover, relative to the working directory.
Fix: set reqCover.reportsDir in the Surefire configuration (0.0.11 or later):
<systemPropertyVariables> <reqCover.reportsDir>${project.build.directory}/reqcover</reqCover.reportsDir></systemPropertyVariables>Coverage is 0% or lower than expected
Section titled “Coverage is 0% or lower than expected”The following requirements were not covered by any test: [#getUsers/200, ...]Check, in order:
- Tests are not linked. Add
@ForRequirementto the test method (or, on trunk, the test class). - IDs do not match. IDs include the leading
#and the response code, for example#getUsers/200. A mismatch shows up asThe following covered requirements are not defined in the requirements specification: [...]. See How IDs are derived. - Tests did not pass. Only passing tests count. Failing, skipped and aborted runs do not.
Java: @ForRequirement("...") does not compile
Section titled “Java: @ForRequirement("...") does not compile”Cause: the annotation attribute is called id; Java’s short form only works for value.
Fix: write @ForRequirement(id = "#getUsers/200"). The short form @ForRequirement("#getUsers/200") works only in Kotlin.
Cucumber: tagged scenarios are not counted
Section titled “Cucumber: tagged scenarios are not counted”Cause: the tag does not start with the configured prefix (default @req:), the plugin is not registered, or the scenario did not pass.
Fix:
- Write tags as
@req:#getUsers/200, or setreqCover.cucumber.tagPrefixto the prefix you use. - Register the plugin:
cucumber.plugin=dev.reqcover.cucumber.RequirementsCoverageListener.
The build fails although all tests pass
Section titled “The build fails although all tests pass”Requirements coverage is below the minimum required coverage of 100.0%. Actual coverage: 80.0%Exiting with error code 1 due to insufficient requirements coverage.Cause: coverage is below reqCover.minimumRequiredCoveragePercent and reqCover.failIfBelowMinimum is true (default).
Fix: cover the listed requirements, lower the minimum, or set reqCover.failIfBelowMinimum=false. The reports are already written; open them to see what is missing.
“Invalid value … for reqCover…”
Section titled ““Invalid value … for reqCover…””Invalid value '100%' for reqCover.minimumRequiredCoveragePercent: expected a number from 0 to 100.Exiting with error code 1 due to invalid ReqCover configuration.Cause: since 0.0.12, a coverage setting with an invalid value fails the build. reqCover.minimumRequiredCoveragePercent must be a number from 0 to 100 without a percent sign; reqCover.failIfBelowMinimum must be true or false.
Fix: correct the value named in the message. The reports are already written.
JUnit: DiscoveryIssueException after adding ReqCover
Section titled “JUnit: DiscoveryIssueException after adding ReqCover”Cause: the project uses JUnit 5 with ReqCover 0.0.10 or 0.0.11. These versions bring the JUnit Platform 6 launcher, which clashes with the JUnit 5 engine.
Fix: upgrade ReqCover to 0.0.12 or later, which uses your project’s JUnit version. See Upgrading.