Hi everyone! New here (long time Android dev), but...
# multiplatform
t
Hi everyone! New here (long time Android dev), but super interested in the project. I have a question about your approach to unit testing; how are you guys dealing with the fact that libraries like MockK don’t support Kotlin/Native yet? I’m thinking of moving unit tests for
commonMain
into
androidTest
so I can use mocking libraries, and just test business logic using Kotlin/JVM. Is this a reasonable approach? Anyone care to share their approach?
m
I try to avoid using mocking libraries for my testings and instead hand roll mocks. This has a benefit of being more performant and less fragile. I typically just use mocking libraries for third party libraries that are final classes.
t
That could work, and I’m assuming in this case your third party libraries aren’t included in the common code?
m
normally but if they are then I just live with only testing on one platform.
🙏 1
n
I wrote Mockative specifically for Kotlin Multiplatform. It allows you to mock any interface much like how you'd mock stuff in MockK, and has gained some traction in the community.
t
@Nicklas Jensen I saw this come by, it looks promising. I think I would prefer this over handrolling all the interfaces, Thanks! I’m going to look into it.
a
We started using MockMP.