Skip to content

In the first blog of our Xamarin.UITest 101 series, we have covered how to set up the Xamarin development environment with Visual Studio on Windows 10, today we will set up a development environment for Apple’s macOS and go through running Xamarin.UITest tests on Android and iOS platforms.

Setting Up Xamarin Environment on macOS

Let’s first set up the macOS environment by installing Visual Studio for Mac.

We can go to and download Visual Studio for Mac.

download vs for mac

After downloading and installing the Visual Studio for Mac development environment, we will be prompted with options for installation.

Select Android and iOS in the Targets section, and click the Install and Update (if any updates) button.

installing vs for mac

Creating a New Project on Visual Studio for Mac

After the installation is completed, we will see a dialogue box with the options to open or create a new project.

Since we have already created a cross-platform Xamarin.Forms app and a sample test of it with Xamarin.UITest in the previous blog, it’s very easy to take the project code to the macOS machine.

Open the project with Visual Studio for Mac.

open a local xamarin uitest project

Android Project

After the project is built, we can install our Xamarin.Forms app on the Android device.

install xamarin app on an android device

And then, we can run our Xamarin.UITest tests against the Android device.

running xamarin.uitest tests on the android device

iOS Project

To launch the app on the Xamarin iOS platform, we need to change our development environment to the necessary configuration of ATXamarin.iOS. Also, we should uncomment the [TestFixture(Platform.iOS)] platform.

installing xamarin app on an ios device

To install the application, we need to select the simulator (where the app will be installed and launched) and click on the Play button.

In our case, we will choose the simulator of the iPhone 11 (iOS 13.3).

running xamarin.uitest tests on the ios device

To run Xamarin.UITest tests, we need to change the configuration of the AppInitializer.cs class.

appinitializer for xamarin ios project

For this, we have to take a path to the app in the AppBundle method. The path should be specified relative to the folder with our test.

Obviously, we have to specify the identifier of our simulator too.

In order to get this identifier, we can use the following command:

xcrun instruments -s devices

xcrun command

We need the identifier of the iPhone 11 (iOS 13.3).

identifier for iphone 11 ios 13.3

After we enter all the necessary data, we can run our tests. But at this stage, there can be an error with the customization of Calabash components.

We need to install Xamarin Test Cloud Agent for the ATXamarin.iOS project.

xamarin test cloud agent

After the package is added, we have to enter the following code block in the AppDelegate.cs class:


appdelegate.cs for ios

After this, we can run Xamarin.UITest tests on the iOS simulator.

running all Xamarin UITest unit tests

When the test is completed, we will see a newly created item (similar to the one created after a test run on the Android device).

the item created on after the Xamarin.UITest test on ios

Petro Kiryshikin

Tech Writer