Chapter 14. Testing mobile apps using Xamarin UITest
This chapter covers
- What UI testing is
- Using Xamarin UITest to do UI testing
- Using the REPL
- Interacting with controls
- Asserting that the UI is correct
As we’ve built our apps, we’ve written a lot of unit tests to verify the model and view-model layers, but we’ve written nothing to test the view layer. Although this layer is small, there could still be issues that aren’t spotted until the app is out in the wild. Fortunately, we can write automated tests to help catch such bugs before users see them, causing them to uninstall our apps and move to a competitor’s offerings.
One of the great things about the MVVM design pattern is that it allows us to maximize the code in our cross-platform model and view-model layers. Not only have we written the bulk of our code just once, but we’ve managed to write unit tests for it, so we have some degree of confidence that the code works. These unit tests are great, but they don’t cover two important questions: have we used the correct controls on our view and bound them correctly, and does our app actually run on the device?