build.gradle.kts
// Add for Kotest integration
testImplementation("com.appmattus.fixture:fixture-kotest:<latest-version>")
Kotest supports property testing, but to use it with more than just the few basic types built into the library requires you to create your own custom generators which you then provide.
Including the fixture-kotest
dependency in your project adds extension
functions checkAll
and forAll
to the fixture. These
functions wrap the equivalent functions from Kotest while providing
generation of all the classes
KotlinFixture supports.
For example:
data class Person(name: String, age: Int)
fixture.checkAll { person1: Person, person2: Person ->
person1 shouldNotBeSameInstanceAs person2
}