Hi All,
Can anyone help me, W.r.to Unit-Tests in KMM
How to get Android context in Kotlin Multiplatform Android test?
t
Tim Oltjenbruns
03/09/2022, 1:47 PM
Generally you shouldn't use context in unit tests.
If you have to, you can mock it with a mocking library. But mock context sparingly, these are integration tests not unit tests
Tim Oltjenbruns
03/09/2022, 1:48 PM
If you're talking about the androidTest folder, and I'm just misunderstanding you, then you can use the instrumentation registry to get the real context on the running device.