Chapter 8. Testing

Throughout the book, we have implemented patterns and best practices with the intention of separating the layers of our TripLog app, making it easier to maintain and test. In this chapter, we will write tests for our business logic by unit testing ViewModels, and we will write tests for our UI with automated UI testing.

Here is a quick look at what we will cover in this chapter:

  • Unit testing with NUnit
  • Automated UI testing with the Xamarin.UITest framework

Unit testing

We will start by testing the business logic in the TripLog app. We will do this by creating a new unit test project in our solution that will be responsible for testing our ViewModels.

There are many options and libraries to create unit tests in .NET. By default, Xamarin ...

Get Mastering Xamarin.Forms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.