https://kotlinlang.org logo
#mockk
Title
# mockk
k

Kris Wong

04/23/2020, 2:55 PM
I found this framework to be pretty interesting when getting started with it, but unless I am missing something here, it doesn't seem to support anything beyond the most basic use cases
o

oleksiyp

04/23/2020, 3:03 PM
:-) check docs. A lot of cases are supported. https://mockk.io I dont know your needs ofc, but probably something is wrong. It is just not that easy do debug remotely via chat
k

Kris Wong

04/23/2020, 3:03 PM
i've been neck deep in the docks for 2 days
o

oleksiyp

04/23/2020, 3:04 PM
I see
As I said general rule is to minimize examples
And submit as github issues
This way it is either something you will fix while minimizing, or a bug, or a not supported thing
k

Kris Wong

04/23/2020, 3:29 PM
as an example, say I want to mock a method that takes an Android context as an argument. what is the proper way to do so?
m

Matt Thompson

04/23/2020, 7:40 PM
I’ve definitely noticed more issues w/android instrumentation tests - not sure if the 1.10.0 fixes any of them, but one workaround is to just use Robolectric w/jvm tests instead
k

Kris Wong

04/23/2020, 7:42 PM
the tests I am writing are run both ways
o

oleksiyp

04/23/2020, 10:04 PM
Android instrumented tests before 28 level doesnt work properly
Because there is no jvmti interface
I dont know if such setup possible, but I would run tests in separate module with minSdkVersion 28+
And jvm test should work very good
2 Views