https://kotlinlang.org logo
#kotest
Title
# kotest
s

Sam

03/10/2022, 10:43 AM
I'm converting some tests from #spek to kotest. Commonly I have this pattern:
Copy code
lateinit var fixture: SomeFixture

beforeEach {
    fixture = createFixture()
}
In Spek, there's a shorthand for that using a property delegate:
Copy code
val fixture by memoized { createFixture() }
Does kotest have anything similar? I think I could create one easily myself as an extension function; just want to make sure it doesn't exist already.
c

christophsturm

03/10/2022, 11:19 AM
just use isolationMode InstancePerLeaf and
val fixture = createFixture()
https://kotest.io/docs/framework/isolation-mode.html
s

Sam

03/10/2022, 11:23 AM
That makes sense, thanks for the suggestion 👍
3 Views