I am building an SDK using kotlin multiplatform fo...
# mockk
v
I am building an SDK using kotlin multiplatform for iOS and Android. Most if not all of my code is in commonMain. Trying to use MocKK library for mocking. Running the tests I am seeing some issues. If I run tests on Android target/task it all works, same is the case on using
./gradlew test
If I select iosSimulatorArm64 as target/task, I get test event was not received. If I run
./gradlew allTest
I get build failed with error - no matching variant of io.mockkMocKK1.11.0. I have io.mockkMocKK1.11.0 in iosXXXTest, AndroidUnitTest & io.mockkmockk common1.10.0 in commonTest. Is this not supported?
a
MockK only supports JVM targets
v
Anything in pipeline? Any alternates, you would suggest?
a
I haven’t seen any significant change in MockK functionality for a few years. Maybe there’s something planned, but I haven’t heard about it. The build config is structured so implementing another target would be possible, but it would be a lot of work. There are a couple of other mocking libraries I’ve got my eye on, but I haven’t used. • https://github.com/bitPogo/kmockhttps://github.com/mockative/mockative The last time I checked I found they’re a little more limited than MockK - they require that the mocked instances are interfaces
v
Mocked instance as interface is no issue. I am concerned more about running tests on both the targets. I have had issues with mockmp before I explored MocKK.
a
oh I haven’t looked at MockMP yet. What problems did you find?
v
It uses Google KSP which doesn't support common code or common testing
a
ah well, I think the same is true for both KMock and Mockative
v
I wonder when we would have better libraries for kmm
105 Views