Kotest IntelliJ Plugin Properties
When running tests through the IntelliJ runner, properties configured in gradle.properties or Gradle build files are not picked up because the runner is not configured to use Gradle.
To support runtime system properties, the Kotest framework always looks for key-value pairs in a kotest.properties file on the classpath, for example in src/main/resources.
All key-value pairs in this file are set as system properties before tests run.
For example, add the following to a kotest.properties file on the classpath:
foo=bar
Then the following test passes:
class FooTest : DescribeSpec() {
init {
describe("after adding kotest.properties") {
it("foo should be set") {
System.getProperty("foo") shouldBe "bar"
}
}
}
}
Common Use Case
If you do not use these features, it is common to disable Kotest’s classpath scanning to save startup time. To do this, add the following to the kotest.properties file:
kotest.framework.classpath.scanning.config.disable=true
kotest.framework.classpath.scanning.autoscan.disable=true
Naming the Properties File
If you do not want to name the file kotest.properties, or if you want to support different files depending on the environment, you can set the property file name with the system property kotest.properties.filename.
For example, if you start tests with kotest.properties.filename=cluster.prd.properties, a key-value file named cluster.prd.properties is loaded before the tests run.