Writing your first test with KotlinTest is very straightforward. Firstly, the KotlinTest dependency will need to be added to your build. The easiest way to do this if you are using Gradle or Maven is to search Maven central for io.kotlintest—just visit http://search.maven.org and grab the latest version.
You will need to do the following:
- Add this to your Gradle build using the following code:
testCompile 'io.kotlintest:kotlintest-runner-junit5:3.3.2'
Alternatively, for Maven, use this code:
<dependency> <groupId>io.kotlintest</groupId> <artifactId>kotlintest-runner-junit5</artifactId> <version>3.3.2</version> <scope>test</scope> </dependency>
- Create the test source folder, usually src/test/kotlin, if it doesn't exist already. We are going to write a unit test for...