VISUAL STUDIO   Windows Mac

Running Xamarin.UITests on Local Devices

PDF for offline use
Related Articles:

Let us know how you feel about this

Translation Quality


0/250

last updated: 2017-07

This guide will discuss how to run Xamarin.UITests on devices attached to your computer.

Overview

Both Visual Studio for Mac and Visual Studio can run tests on devices attached to your computer. This is very similar to running the tests on an Android emulator or iOS simulator.

The following sections to this guide will cover some of the steps involved with running UITests on a physical device:

  • It is not possible to run UITests for iOS on Windows.
  • Troubleshooting – This guide provides some tips and guidance for some of the more common issues that may occure when testing with physical devices.

Requirements

You must first package the APK or IPA before running the test on a local device. The IDE will not build the application bundle prior to running the test.

Xamarin Test Cloud and Xamarin.UITest only support Android and iOS applications. The Windows Phone and Windows versions of Xamarin.Forms apps cannot be tested in Test Cloud.

It is important to understand the concepts described in the Introduction to Xamarin Test Cloud guide.

It is assumed that the most recent stable version of the Xamarin.UITest NuGet Package is installed in the UITest project. It is assume that iOS projects have the most recent version of the Xamarin Test Cloud Agent installed.

iOS devices must be configured with a valid development provisioning profile.

In order to run Xamarin.UITests with Visual Studio for Mac, the following dependencies must be met:
  • NUnit 2.6.x – Xamarin.UITest is not compatible with NUnit 3.x.
  • Android SDK – Only if testing Android apps.
  • Java Developers Kit – Only if testing Android apps.
  • Xcode Command Line Tools – Only for testing iOS apps.

In order to run Xamarin.UITests with Visual Studio, the following dependencies must be met:

  • NUnit 2.6.x – Xamarin.UITest is not compatible with NUnit 3.x.
  • A Test Runner for Visual Studio – A 3rd party test runner, such as the NUnit Test Adapter for NUnit 2 or Resharper from Jetbrains, is required for Visual Studio to be able to run the NUnit tests. The NUnit3TestAdapter is not compatible with Xamarin.UITest.
  • Android SDK – Only if testing Android apps. Windows requires that the ANDROID_HOME environment variable is set with the path to the Android SDK.
  • Java Developers Kit – Only if testing Android apps.
⚠️

It is not possible to run UITests for iOS apps on Windows.

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.