You can manually modify your build system to ensure that the required libraries are available. The following sections list all the libraries UTA may require. The set of dependencies you need to configure depends on your testing framework and may vary between projects. 

The following frameworks are supported:

FrameworkDetails
JUnit 4Supported for Gradle, Maven, and Ant.
JUnit 5 and 6Supported for Gradle and Maven.

Adding Dependencies in Maven

Modify the pom.xml file by updating the <dependencies> section.

(info) Multi-module projects may require centralizing dependency information in the <dependencyManagement> section.

If you use JUnit 6 or both JUnit 6 and 4:

<!-- JUnit 6 -->
<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter</artifactId>
    <version>6.1.3</version>
    <scope>test</scope>
</dependency>
 
<!-- JUnit 6 runner for JUnit 4-->
<dependency>
    <groupId>org.junit.vintage</groupId>
    <artifactId>junit-vintage-engine</artifactId>
    <version>6.1.3</version>
    <scope>test</scope>
</dependency>
 
<!-- JUnit 6 requires Java 17, so Mockito 5 is suitable -->
<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-core</artifactId>
    <version>5.24.0</version>
    <scope>test</scope>
</dependency>

If you use JUnit 5 or both JUnit 5 and 4:

<!-- JUnit 5 -->
<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter</artifactId>
    <version>5.12.1</version>
    <scope>test</scope>
</dependency>

<!-- JUnit 5 runner for JUnit 4-->
<dependency>
    <groupId>org.junit.vintage</groupId>
    <artifactId>junit-vintage-engine</artifactId>
    <version>5.12.1</version>
    <scope>test</scope>
</dependency>

<!-- Mockito 5 for projects with Java 11 or newer -->
<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-core</artifactId>
    <version>5.16.0</version>
    <scope>test</scope>
</dependency>

<!-- Mockito 4 for projects with Java 8, 9, 10 -->
<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-inline</artifactId>
    <version>4.11.0</version>
    <scope>test</scope>
</dependency>

<!-- Add if you create Spring integration tests -->
<dependency>
	<groupId>org.springframework</groupId>
	<artifactId>spring-test</artifactId>
	<version>5.3.39.RELEASE</version>
	<scope>test</scope>
</dependency>

If you only use JUnit 4:

<!-- JUnit 4 -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.13.2</version>
    <scope>test</scope>
</dependency>

<!-- JUnitParams for JUnit 4 -->
<dependency>
    <groupId>pl.pragmatists</groupId>
    <artifactId>JUnitParams</artifactId>
    <version>1.1.1</version>
    <scope>test</scope>
</dependency>

<!-- Mockito 5 for projects with Java 11 or newer -->
<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-core</artifactId>
    <version>5.16.0</version>
    <scope>test</scope>
</dependency>

<!-- Mockito 4 for projects with Java 8, 9, 10 -->
<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-inline</artifactId>
    <version>4.11.0</version>
    <scope>test</scope>
</dependency>

<!-- Add if you create Spring integration tests -->
<dependency>
	<groupId>org.springframework</groupId>
	<artifactId>spring-test</artifactId>
	<version>5.3.39.RELEASE</version>
	<scope>test</scope>
</dependency>

Adding Dependencies in Gradle

Modify the build.gradle file by updating the following sections. The following entries include all the required libraries:

If you use JUnit 6 or both JUnit 6 and 4:

test {
   useJUnitPlatform()
}
 
dependencies {
 
    // JUnit 6
    testImplementation 'org.junit.jupiter:junit-jupiter:6.1.3'
 
    // JUnit 6 runner for JUnit 4
    testImplementation 'org.junit.vintage:junit-vintage-engine:6.1.3'

    // JUnit 6 requires Java 17, so Mockito 5 is suitable
    testImplementation 'org.mockito:mockito-core:5.24.0'
}

If you use JUnit 5 or both JUnit 5 and 4:

test {
   useJUnitPlatform()
}

dependencies {

    // JUnit 5
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.12.1'
    testImplementation 'org.junit.jupiter:junit-jupiter-params:5.12.1'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.12.1'
    testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.12.1'

    // JUnit 5 runner for JUnit 4
    testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.12.1'

    // Mockito 5 for projects with Java 11 or newer
    testImplementation 'org.mockito:mockito-core:5.16.0'

    // Mockito 4 for projects with Java 8, 9, 10
    testImplementation 'org.mockito:mockito-inline:4.11.0'

    // Add if you create Spring integration tests
    testImplementation 'org.springframework:spring-test:5.3.39.RELEASE'
}

If you only use JUnit 4:

dependencies {
    // JUnit 4
    testImplementation 'junit:junit:4.13.2'

    // JUnitParams for JUnit4
    testImplementation 'pl.pragmatists:JUnitParams:1.1.1'

    // Mockito 5 for projects with Java 11 or newer
    testImplementation 'org.mockito:mockito-core:5.16.0'

    // Mockito 4 for projects with Java 8, 9, 10
    testImplementation 'org.mockito:mockito-inline:4.11.0' 
  
    // Add if you create Spring integration tests
    testImplementation 'org.springframework:spring-test:5.3.39.RELEASE'
}

Adding Dependencies in Ant (JUnit 4)

Ant requires all required JAR files to be added to a separate directory.  You must manually include the directory in the build.xml file:

<classpath>
    <!-- filesets can be used in classpath and bootpath -->
	<fileset dir="C:/directory_name/lib">
				<include name="**/*.jar"/>
    </fileset>
</classpath>

The following libraries are required:

  • byte-buddy-1.15.1.jar
  • byte-buddy-agent-1.12.19.jar
  • hamcrest-core-1.3.jar
  • junit-4.13.2.jar
  • JUnitParams-1.1.1.jar
  • mockito-core-4.11.0.jar
  • mockito-inline-4.11.0.jar
  • objenesis-3.3.jar

The libraries are available online or in the <INSTALL_DIR>/examples/demo/lib.

  • No labels