Add documentation for usage with `Mockk` and other mock libraries
See original GitHub issueRecently, in Mockk
’s slack and KotlinTest
’s slack, some users have reported troubles when using Mockk
with KotlinTest, due to the mockk context not being cleared after tests.
This is due to the isolation mode being incorrect for the use case, as the user normally wants the class to be instantiated once per test (InstancePerTest
isolation).
As Mockk
is a very used mocking library for Kotlin, among other libraries, maybe we should create a specific part in the documentation for explaining this, or a paragraph in isolation mode.
Users don’t associate directly that the “Bug” in their mocks using KotlinTest is due to isolation mode. Usually because the default mode for JUnit is single instance per test, and we don’t do that, so writing the same test “bugs” their code because of it.
What do you think, @sksamuel ?
Also summoning @oleksiyp
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:19 (13 by maintainers)
Top GitHub Comments
I made a gist about getting up and running with kotest and mockk if anyone stubles upon this like i did and wants some copy paste code
It could be because MockK only scans top level fields. @kerooker is that the case ?
On Sun, 12 Apr 2020 at 10:00, Oliver Culley de Lange < notifications@github.com> wrote: