Xamarin.UITest is a C#-based testing framework enabling automated UI acceptance tests for iOS and Android applications that can be uploaded to Xamarin Test Cloud to test on over 1,000 real devices. Xamarin.UITest is available as a NuGet package and relies on the popular NUnit testing framework that most C# developers are familiar with.
In this video, Dan Waters shows us the steps to utilize UITest, and also how to use the interactive shell (REPL) included with Xamarin.UITest to explore the views on a screen and to automate interactions with the application. The best thing about Xamarin.UITest is that it tests any mobile app regardless of the platform it’s written in – Objective-C, Java, Xamarin, or 3rd party frameworks.
Each test is a method inside an NUnit Test Fixture class and follows the Arrange-Act-Assert pattern:
- Arrange – The test sets up conditions and initializes so that the test can be actioned.
- Act – The test interacts with the application, entering text, pushing buttons, tapping, etc.
- Assert – The test examines the results of the actions performed in the Act step to determine correctness. For example, the application may verify that a particular error message is displayed.
Watch it in full-screen to see the code and Xamarin.UITest in action.