Test Automation Tools: Xamarin | spriteCloud

spriteCloud
4 min readNov 16, 2020

For more reviews of Test Automation Tools and Frameworks, head to our main topic page.

Mobile Test Automation using Xamarin.UITest

The mobile test automation scene is growing fast and when it comes to a single environment for mobile app development that also allows for easy test automation, Xamarin certainly is a solution worth your attention. Let’s take a moment to talk about Xamarin from a development perspective but before we get into using Xamarin for testing. Testing is our domain of expertise so we will focus on that part a little more than the development side of Xamarin

We asked our Test Engineer, Nafeez Virani, to give us a review of his experience working with Xamarin.

For reviews of Test Automation Tools, check out our reviews of TestCafe, Cypress and Detox.

What is Xamarin?

Xamarin is a free, open-source platform from Microsoft for creating apps for Android and iOS with .NET and C#. It allows developers to create cross-platform apps from a single shared codebase while allowing the ability to choose to have a consistent look across platforms or the native look and feel of each operating system.

Xamarin gives .NET developers the ability to create apps for other ecosystems, obviously without needing to learn other programming languages. Needless to say, this is pretty useful for all the .NET developers out there.

How does Xamarin do this?

Xamarin is able to allow for cross-platform development with Android, iOS, and macOS by extending the .NET framework by adding extra features to the platform. Features like:

  • Base framework for accessing native features
  • Extensible Markup Language, known as XAML, for building dynamic mobile apps using C#
  • Libraries for common patterns, such as Model-View-ViewModel (MVVM)
  • Platform-specific libraries that include access to APIs from Google, Apple, Facebook, and more to add rich capabilities
  • Editor extensions to provide syntax highlighting, code completion, designers, and other functionality specifically for developing mobile pages

With these features alone, Xamarin already has a lot to offer organisations working in mobile app development. It’s free, open-source, and it supports the major mobile operating systems on the market.

Xamarin for UI Testing

Xamarin is pretty amazing and featured packed when it comes to developing mobile apps but it also shines when it comes to testing apps. Testing is our domain of expertise here at spriteCloud so we will spend a lot of time talking about the test automation with Xamarin.UITest.

Xamarin.UITest Framework

Included in the Xamarin’s framework for creating native mobile applications is a testing framework that enables Automated UI Acceptance Tests written in C#. This is useful because 3rd party apps for native mobile app testing still leave a lot to be desired. Xamarin.UITest is purposely created for Xamarin making it much more reliable and easier to use as it tightly integrates with Xamarin.iOS and Xamarin.Android projects.

Xamarin.UITest uses the NUnit unit testing framework which is run against iOS and Android apps. Using this test framework does not limit you to Xamarin however, as it can also be used with iOS and Android projects written natively in Objective-C/Swift (Apple’s programming language) and Java (Android’s programming language).

The tests interact with the user interface just as a user would, namely via entering text, tapping buttons, and performing gestures, such as swipes.

Watch our short demo of using Xamarin.UITest to get an idea of how it works.

Xamarin Test Cloud / Visual Studio App Center Test

Xamarin’s Test Cloud is now part of the Visual Studio App Center Test. App Center Test is a test automation service for the native and hybrid mobile apps where tests written using the supported frameworks (Appium, Calabash, Espresso, Xamarin.UITest, XCUITest) can be run on the hundreds of unique device models and operating systems hosted in the Data Center.

When testing for mobile applications it is important that the test environment (i.e. the devices and operating systems) provides the best approximation of the user’s real world environment. App Center Test also called Test Cloud, uses real mobile devices that aren’t rooted or jailbroken, providing reliable test data.

Some other handy features of App Center Tests/Test Cloud:

  • Screenshots are automatically captured and attached to each test step and can be viewed side by side for all targeted devices in a test run.
  • You can view the device log for all target devices in a test run and stack traces for failed test steps.
  • Run tests on multiple devices simultaneously to speed up time to results

While App Center Test/Test Cloud has a lot of plus points going for it, it does have a few minus points. Chiefly, Test Cloud doesn’t currently support manual testing, the use of VPNs, load testing, network condition simulations or cellular network connections. This limits the scope of tests that can take place.

The decision to choose to use Xamarin and Microsoft Visual Studio Ecosystem is obviously dependent on a lot of factors but from an interoperability standpoint with testing, Xamarin gets a big thumbs up from spriteCloud.

Which automation tool or framework would you like to see us demo next? Let us know at info@spriteCloud.com

Originally published at https://www.spritecloud.com on November 16, 2020.

--

--

spriteCloud

We’re spriteCloud, a community of software quality assurance and cybersecurity testers located in Amsterdam. Put quality first!