Here's your chance to speak at GraphQL Summit in New York City, October 8 - 10, 2024! 🏙️ Submit your proposal by May 31.
Docs
Launch GraphOS Studio
You're viewing documentation for an upcoming version of this software. Switch to the latest stable version.

Testing in Apollo Kotlin

Overview


provides the following tools to help with testing your code:

MockServer creates a full HTTP server. It requires minimal changes to your production code (you only need to change serverUrl), which means you can use the same ApolloClient for tests and production. MockServer is also useful for testing specific server behaviors, such as error cases, HTTP headers, and timeouts.

TestNetworkTransport bypasses HTTP calls altogether and returns predefined GraphQL responses. It requires more modifications to your production code, but you can use it in lighter tests that don't need to create a server. You can use test builders to instantiate the data in the responses.

Previous
Android Studio plugin
Next
Mocking HTTP responses
Edit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc.

Privacy Policy

Company