Quick Start
Kotest is a flexible and comprehensive testing project for Kotlin with multiplatform support.
For latest updates see Changelog.
Kotest is divided into three, stand-alone projects, each of which can be used independently:
You can decide to go all in on Kotest and use all three together, or you can choose to one or more modules in conjunction with other projects. For example, you could use the assertion library with JUnit, or you could use the test framework with another assertion library like AssertJ.
This page gives setup instructions for various combinations of projects and targets.
Kotest is a multiplatform project and supports all targets - JVM, JS, Native, iOS and so on.
Test Framework​
The Kotest test framework is supported on all targets. On the JVM it builds on top of the JUnit Platform project, and on Kotlin Multiplatform, it leverages the existing Gradle Test infrastructure. To set up kotest as your testing framework, follow detailed instructions in the framework documentation page.
Assertions Library​
The core assertions library framework is supported on all targets. Extensions are supported on the platforms that are applicable to that extension. For example, the JDBC matchers are only provided for the JVM since JDBC is a Java library.
- JVM/Gradle
- JVM/Maven
- Multiplatform
Add the following dependency to your dependencies block:
testImplementation("io.kotest:kotest-assertions-core:$version")
Add the following dependency to your build.
<dependency>
<groupId>io.kotest</groupId>
<artifactId>kotest-assertions-core-jvm</artifactId>
<version>${version}</version>
<scope>test</scope>
</dependency>
Add the following dependency to your commonTest or target specific dependencies block:
implementation("io.kotest:kotest-assertions-core:$version")
View the assertions library documentation for more information.
Property Testing​
The property test framework is supported on all targets.
- JVM/Gradle
- JVM/Maven
- Multiplatform
Add the following dependency to your build:
testImplementation("io.kotest:kotest-property:$version")
Add the following dependency to your build.
<dependency>
<groupId>io.kotest</groupId>
<artifactId>kotest-property-jvm</artifactId>
<version>${version}</version>
<scope>test</scope>
</dependency>
Add the following dependency to your commonTest or target specific dependencies block:
implementation("io.kotest:kotest-property:$version")
View the property testing documentation for more information.
Snapshots​
Snapshots are automatically published on each commit to master. If you want to use the latest snapshot build,
set up the dependencies in the same way described above, changing the version to the current snapshot version
and add the following repository to your repositories block:
repositories {
maven("https://central.sonatype.com/repository/maven-snapshots/")
}
The latest snapshot version can be found on the GitHub README page in the badges section.