Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ktor client MockEngine not resolved in android

I've added the dependency for Ktor client mock

testImplementation "io.ktor:ktor-client-mock:$ktor_version"

But still the MockEngine is not resolved.

like image 615
saiedmomen Avatar asked Dec 08 '18 13:12

saiedmomen


2 Answers

This is a multi-platform module with no actual implementations. to use in platform modules, jvm in the case of android a corresponding dependency should be used. In this case you should use instead:

testImplementation "io.ktor:ktor-client-mock-jvm:$ktor_version"
like image 158
saiedmomen Avatar answered Nov 15 '22 00:11

saiedmomen


I have written an article about Ktor and Ktor client mock where you can review a working example.

https://medium.com/@xurxodev/how-to-create-a-rest-api-client-and-its-integration-tests-in-kotlin-multiplatform-d76c9a1be348

The source code is on this GitHub repository https://github.com/xurxodev/integration-testing-kotlin-multiplatform-kata

Review it and let me know if you have some doubts

like image 24
xurxodev Avatar answered Nov 14 '22 23:11

xurxodev