Hi, I am writing an android instrumentation test t...
# coroutines
r
Hi, I am writing an android instrumentation test to test one of my fragments. The fragment uses a (real) viewmodel and I have declared mocks for it to use. The issue is one of these mocks (a repository class) has a suspend function and I am not sure what to do in the test.
m
I am not sure I follow the issue. I usually test through UI when I am doing Android Instrumentation tests - that way I don't mind asynchronous behavior. If you test through e.g. ViewModel but still want to test on real device, in that case you will use something like
runTest
with
TestDispatcher
.
r
The issue (now solved) is that i needed to mock the repository class, I achieved this with
coEvery
from mockk.