UITests Overview

Xamarin.UITests Quick Starts
Overview
These quick starts will take you through writing some automated tests using Xamarin.UITest for a sample
application. The user can enter a credit card number, and the application will validate the credit card
number according to this one rule:
The credit card number must be exactly 16 characters long.
If the user enters a credit card message that is too long or too short, then the application will display an
error message with that information.
This application has a fairly simple workflow, so we will be able to keep all of the UITests in a single test
fixture. This one test fixture will have four tests in it:
No Credit Card Number – The application should display an error message that the value isn't a
credit card number.
A 15-digit Credit Card Number – The application should display an error message that the credit
card number is too short.
A 16-digit Credit Card Number – The application should display a new screen with a message that
the credit card number is valid.
A 17-digit Credit Card Number – The application should display an error message that the credit
card number is too long.
The following screenshots show the application in action on Android and iOS, respectively:
To keep things simple, the quick starts will only focus on a single platform at, and we'll only write one
UITest. Each platform is covered in its own section.
In these quick starts we will cover the following:
Exploring the UI with the REPL – UITest provides an interactive shell, known as a REPL (readeval-print-loop) that can be used to explore the user interface.
Using the UITest API – We shall see some of the UITest API's that are used to interact with the user
interface.
Running the Tests – First we will run the tests locally as they are being developed, then we will
upload them to Xamarin Test Cloud.
Requirements
You must already have an account with Xamarin Test Cloud and be familiar with the Introduction to
Xamarin Test Cloud guide. You must also have setup a Test Cloud team, as described in the Organizations
& Teams
You must also be familiar with writing tests using NUnit.
It is possible to run Xamarin.UITests locally, however, it is only possible to run to run iOS locally on a Mac.
Xamarin Test Cloud will not run tests that were created using another testing framework such as MSTest or
xUnit.