In the preceding section we saw how Android Studio provides a comprehensive set of tools for testing our code, but writing these tests is time consuming, and with anything other than the most trivial of projects will require many individual tests. Fortunately, Android Studio provides a semi-automated way to construct tests, using our own UI interactions to create, identify, and perform code elements of the test.
The following simple exercise shows how this is done to perform the preceding test we just wrote by hand:
- Open the project with the spinner we created in the previous exercise, or create a new one.
- Select Record Espresso Test from the Run menu.
- Select an item from the spinner. This will be reflected in the Record ...