Tests created by Diffblue Cover make use of a testing framework, namely one of JUnit 4, JUnit Jupiter, or TestNG - these frameworks are included in the required dependencies below. These dependencies are available from the Maven Central Repository. To add it, follow the guide relevant to your build tool.
Maven
Check whether or not the test framework dependencies are already in your Maven project. If not, follow the instructions below to add it:
With recent versions of surefire, it is not necessary to specify any plugin dependencies for the specific testing framework being used; surefire will detect the versions specified in the project dependencies section as specified below.
Explicitly specifying a testing framework in the plugin dependencies (e.g. to override the provider) can result in a reduced capability in the surefire plugin. In some cases, this can prevent Cover from grouping tests correctly which affects coverage calculations.
Add JUnit or TestNG to the dependencies section:
For JUnit 4:
For JUnit Jupiter 5:
For TestNG:
Gradle
Check whether or not the test framework dependencies are already in your Gradle project. If not, follow the instructions below to add it:
Edit the build script (build.gradle or build.gradle.kts).
Add Maven to the repositories section.
Add JUnit or TestNG to the dependencies section:
For JUnit 4:
For JUnit Jupiter 5:
For TestNG:
The versions specified are the latest at the time of writing. Please use the latest versions available for the best results
Run the tests
Choose one of the new test classes in the project explorer, right-click and select 'Run ClassnameTest'. The IDE will then show the results of the run.