Sign in Go Pro

MockWebServer

Getting Set Up for Testing

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next

Previous

About

To test with MockWebServer, you need to set up your app to talk to the real server normally, but switch to MockWebServer during testing. In this lesson you will learn: How to test Retrofit with MockWebServer Quick review of how to use OkHttpIdlingResource to wait for Retrofit to complete its network calls How to use a custom test runner to instantiate a different Application during test How to have the test application return the MockWebServer base url for Retrofit to use How to enqueue a response to MockWebServer in your Espresso test

Lessons in MockWebServer