@@ -4,6 +4,10 @@ Kotlin integrates seamlessly with the Maven ecosystem, allowing you to use indus
44applications. In this guide, you'll learn how to create tests with JUnit and use Maven plugins to run unit and integration
55tests.
66
7+ > For a detailed guide on setting up your Maven project to use both Kotlin and Java, see [ ] ( mixing-java-kotlin-intellij.md#project-configuration ) .
8+ >
9+ {style="tip"}
10+
711## Create tests with JUnit
812
913[ JUnit] ( https://junit.org/ ) is the standard testing framework for Kotlin backend development. While Kotlin is compatible
@@ -18,7 +22,7 @@ in the necessary JUnit artifacts.
1822
1923#### JUnit 5 and later
2024
21- For all new projects, use the ` kotlin-test-junit5 ` artifact. It provides full support for the JUnit, including features
25+ For all new projects, use the ` kotlin-test-junit5 ` artifact. It provides full support for JUnit, including features
2226like nested tests and parallel execution. Kotlin/JVM supports the latest stable JUnit version, JUnit 6.
2327
2428Update your ` pom.xml ` file as follows:
@@ -34,6 +38,10 @@ Update your `pom.xml` file as follows:
3438</dependencies >
3539```
3640
41+ > Despite its name, ` kotlin-test-junit5 ` supports all latest JUnit versions, including JUnit 6.
42+ >
43+ {style="note"}
44+
3745#### JUnit 4
3846
3947If you'd like to use an earlier version of JUnit, for example, for a legacy project, use the ` kotlin-test-junit ` artifact
@@ -51,6 +59,10 @@ that utilizes JUnit 4:
5159</dependencies >
5260```
5361
62+ > For a detailed guide on using JUnit for testing and a sample project, see the [ Test Java code with Kotlin] ( jvm-test-using-junit.md ) tutorial.
63+ >
64+ {style="tip"}
65+
5466### Write unit tests
5567
5668Unit tests verify isolated parts of your code, such as individual functions or classes.
@@ -108,7 +120,7 @@ By default, it executes during the `test` phase of the build lifecycle and fails
108120<plugin >
109121 <groupId >org.apache.maven.plugins</groupId >
110122 <artifactId >maven-surefire-plugin</artifactId >
111- <version >3.2 .5</version >
123+ <version >3.5 .5</version >
112124</plugin >
113125```
114126
@@ -131,7 +143,7 @@ The build finally fails during the `verify` phase if there were any test failure
131143<plugin >
132144 <groupId >org.apache.maven.plugins</groupId >
133145 <artifactId >maven-failsafe-plugin</artifactId >
134- <version >3.2 .5</version >
146+ <version >3.5 .5</version >
135147 <executions >
136148 <execution >
137149 <goals >
0 commit comments