Getting-started
Apollo MockServer is a KMP server for your HTTP and WebSocket tests.
Features:
Enqueue mocked HTTP responses
Dequeue recorded HTTP requests
Enqueue mocked WebSocket messages
Dequeue recorded WebSocket messages
JVM, Native and JS (Node) support
Apollo MockServer was initially developed for Apollo Kotlin integration tests and is provided as-is to the community.
Performance and compatibility are minimal. Do not use in production.
Non-goals:
HTTP2/HTTP3
HTTPS/TLS
Performance
Should a future version of Ktor or any other server framework provide a commonMain
API, Apollo Kotlin MockServer would probably become deprecated.
In the meantime, add the dependency to your project and enjoy cross-platform integration tests!
Enqueuing mock responses
To enqueue responses, use MockServer.enqueue
:
Reading recorded requests
Use MockServer.awaitRequest()
to retrieve a recorded request that you can assert to check the behaviour of your client code.
Next steps
Take a look at the Recipes or WebSockets pages to learn more.