Xamarin.UITest 101 - Basics, Tips & Best Practices

  December 16, 2019

Like Appium and Robot Framework, Xamarin.UITest is among the best open-source, cross-platform UI testing frameworks. It’s a more straightforward choice when it comes to automating Android and iOS apps built with Xamarin.Forms. Starting from this week, we are going to share our learnings about Xamarin.UITest and guide you through how to get started with this framework on Bitbar in our new series of blogs – Xamarin.UITest 101.

Xamarin and Xamarin.Forms

The ultimate goal of a cross-platform mobile framework should be to enable mobile developers to write a single shared codebase and deploy it on both Android and iOS. Just like Flutter and React Native, Xamarin is one of the likes of cross-platform frameworks. Let’s see why Xamain is one of the most important frameworks for mobile development and testing.

Xamarin.Forms

Xamarin comes with many nice features including Xamarin.Forms. It is an open-source cross-platform framework from Microsoft for building iOS and Android with .NET from a single shared codebase.

Developers can use the built-in pages, layouts and controls from Xamarin.Forms to build and design beautiful Android and iOS apps from a single, highly extensible API. It’s easy to subclass any control to customize their behavior or define your own controls, layouts, pages, and cells to make your app pixel perfect.

Apps built with Xamarin.Forms can be tested using Xamarin.UITest, including sharing the same test code.

A Brief Story of Calabash

Before we move onto Xamarin.UITest, it’s worth quickly mentioning Calabash. Calabash used to be very popular among mobile developers and testers. It is a very powerful open-source mobile app testing tool and a Behavior-Driven Development (BDD) framework that works for both Android and iOS and allows tests to be written in Ruby using Cucumber.

After delivering support for the final releases of iOS 11 and Android 8 operating systems, Microsoft discontinued its contributions to Calabash. That being said, the community has been continuing to fully adopt and maintain it.

Xamarin.UITest

Xamarin.UITest is an automated testing framework that allows developers and testers to write UI acceptance tests written in C# using the NUnit unit testing framework. It is the Automation Library that allows the NUnit tests to execute on Android and iOS devices.

Although Xamarin.UITest integrates tightly with Xamarin.Android and Xamarin.iOS projects, you can also use it with Android and iOS projects that are written natively in Java and Objective-C/Swift.

As the sibling of Calabash, Xamarin.UITest is based on Calabash and shares a similar operating principle and the same logic with Calabash. For anyone that is still curious about Xamarin.UITest vs. Calabash, below is a diagram from the Xamarin community that concisely explains whether you should use Xamarin.UITest or Calabash to automate mobile apps, depending on if apps are built with Xamarin.Forms or not.

xamarin.uitest 101 - xamarin.uitest vs. calabash

Agenda for Xamarin.UITest 101

From this week, we will explore steps to get started with Xamarin.UITest to automate mobile apps built with Xamarin.Forms. Below you can find a brief agenda for each topic and make sure you follow us every week.

We hope you will take away some insights from our Xamarin.UITest 101. Stay tuned for the first blog!