Kotest Global Configuration
Some property test settings can be configured globally for all property tests.
Default Iteration Count
The standard default iteration count is 1000. In other words, if a property test does not specify an iteration count, the default is 1000.
You can override this default by assigning a value to PropertyTesting.defaultIterationCount or by using the system property kotest.proptest.default.iteration.count.
Any test that sets the iteration count directly will, of course, use that value.
For example:
PropertyTesting.defaultIterationCount = 123
// will use 555 iterations specified in the test
forAll<String, String>(555) { a,b -> a + b == "$a$b" }
// will use 123 iterations from the global default
forAll<String, String> { a,b -> a + b == "$a$b" }
If you use the Kotest framework, you can do this before tests using project configuration.
class KotestConfig : AbstractProjectConfig() {
override suspend fun beforeProject() {
PropertyTesting.defaultIterationCount = 123
}
}
Printing Shrink Steps
By default, when shrinking is used, each shrink step is not logged and only the final shrunk value is recorded.
To enable logging of each intermediate value, assign true to PropertyTesting.shouldPrintShrinkSteps or use the system property kotest.proptest.output.shrink-steps=true.