saiedmomen
saiedmomen

Reputation: 1431

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.

Upvotes: 5

Views: 1239

Answers (2)

xurxodev
xurxodev

Reputation: 1837

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

Upvotes: 1

saiedmomen
saiedmomen

Reputation: 1431

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"

Upvotes: 5

Related Questions