Working with code R005
R005 - Unable to load class
The output code R005 generally means that we tried to load a class (e.g. a parameter type) in order to write a test, but failed to do so. This can occur in the context of unit tests for Spring, Java Enterprise Edition (and a few other examples) since some Maven/Gradle dependencies are not available at
An additional reason that classes fail to load can be when the class in question has previously caused an R006 because the static initializer failed to run - often because it attempted to perform an I/O operation that Cover blocked, or timed out. If you've also seen an R006 for the same class then try to address that first by minimizing static initializer logic.
pom.xmlfile or a Gradle build script (
build.gradle.kts) specifies the steps necessary to create a software artifact from the source code. This includes managing the dependencies on third-party libraries and frameworks. Both Maven and Gradle allow us to define different groups of dependencies. These dependency groups are called "scopes" in Maven and "configurations" in Gradle. Diffblue Cover uses
testscopes / configurations.
The dependency scopes available to Diffblue are:
provided. However, the
providedscope is not transitive, which may be a cause of R005 errors. If Diffblue Cover reports that a class indirectly included by a dependency is missing, you can try to resolve this issue by including an additional reference to this indirect dependency at
Again, you must use the correct dependency configurations to avoid receiving the output code R005.