Maven dependencies
How to add the test framework dependency into your Maven build system so the tests written by Cover Plugin will run successfully.
After Cover Plugin has written tests for your project, they will be automatically integrated into your test suite. Before you can run the tests, you need to add any required dependencies for your particular build system.
Tests created by Diffblue Cover make use of a testing framework, namely one of JUnit 4, JUnit Jupiter, or TestNG, so 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.
Check whether or not the test framework dependencies are already in your Maven project. If not, follow the instructions below to add it:
- 1.Edit the root
pom.xml
- 2.Add this dependency information to the
<dependency>
section:
JUNIT 4
JUNIT JUPITER 5
TESTNG
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.8.0</version>
<scope>test</scope>
</dependency>
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 JUnit run.
Last modified 21d ago