Tobi
01/11/2019, 2:54 PMio.ktor.client.engine.mock.MockEngine
in my multiplatform project commonTest
source set in order to test my engine configuration, but I can’t import it 🤔
I added implementation "io.ktor:ktor-client-mock:$ktor_version"
to my commonTest.dependencies
closure in the multiplatform build.gradle
, but it seems like the dependency can’t be resolved.
Any ideas?jvmTest
source set when adding io.ktor:ktor-client-mock-jvm:$ktor_version
to the jvmTest.dependencies
closure.
Not really what I wanted, since I’d like to test it for all targets, not just jvm.
Furthermore I figured out, I can’t write the test I want to. My idea was to test an interceptor
I added, which adds an query param to the defaultRequest
by using the MockEngine
and checking the correct url is called.
But a) I can’t replace the engine of a client and b) even if I could, the interceptor I wrote is part of the engine
and would have been overwritten if I could use the MockEngine
🤔MockEngine
in commonTest
?
2) How would I test the above mentioned interceptor?Saiedmomen
01/11/2019, 4:14 PMTobi
01/11/2019, 4:40 PMiOS
and JVM
. And it works, almost… 🙂 The problem I am facing now is that runBlocking
is not available, which I use to wait for the result. Afaik this is one of the limitations regarding Kotlin/Native
and coroutines, so I guess I need to keep the test in the jvmTest
source set for now 😞
2) That makes sense. Thanks for the explanation 👍Saiedmomen
01/11/2019, 5:41 PM