I am curious, has anybody used ktor as replacement...
# ktor
a
I am curious, has anybody used ktor as replacement for a mock web server in both Android and iOS automation? I know there is a MockEngine, but that only seems useful if all client requests are being made with a Ktor client and unfortunately my app is not fully converted over yet. So was curious if anybody has tried that or if its even a good use case for ktor?
m
I use Ktor on (jvm) backend as a fake web server - replacing other API's with their simplistic HTTP implementation with Ktor. This way it works with any clients - I just have to repoint them to
<http://localhost>:<port where the ktor is running>
. Not sure whether it's exactly what you're looking for, but definitely an option.
a
Interesting, does that support any dynamic changes in the server response with your setup? Or is the server just simply returning some static values for the api?
m
The main idea is to have it dynamic indeed. A simplistic implementation of the external dependency. E.g. "create payment transaction" to a paygate will return a response with a new id and store this transaction state in an in-memory map. When asked for the status of this transaction, this fake will return the status derived from the previous interactions .
d
Try wiremock.