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.

14.1. Introduction to UI testing

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?

14.2. Writing tests

 
 
 
 

14.3. Testing incrementing a counter

 
 
 

14.4. The app interface and app queries

 

Summary

 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest