Setup Xamarin UI Tests In Visual Studio Appcenter


This blog takes user for setting up Visual studio appcenter for uploading and running Xamarin Automation tests. This article assumes below prerequisites are enabled.
  1. Azure subscription with billing enabled as per contract to use Appcenter(contact IT admin for setup) or a Trial account can be setup for 30 days for Testing and unlimited build uploads.
  2. Appcenter account with billing enabled via Azure subscription(for more info visit.
  3. Node is installed and able to access npm commands(Link for Node installer which has both windows and Mac versions and users are expected to download the stable version)


  1. Login to Appcenter and create a new App by clicking Add App in right corner (in our case App is already created)
  2. Select OS as Android or iOS and platform as Xamarin as shown below,

    Figure 1.1 Create a new app and selecting the OS 

  3. Once the app is created Navigate to below page by clicking on Test and under Test Runs from left side Hamburger menu.

    Figure 1.2 Test Run selection

  4. Click on New Test Run button and select Devices for test and click in select device. The devices can be filtered based on OS, make and model. 

    Figure 1.3 Create a new app and selecting the OS  

    Figure 1.4 Filter selection for devices based on OS and make

  5. In next screen select Test framework as Xamarin Ui test and leave everything as it is default settings.

    Figure 1.5 Configuring Test run to use Xamarin UI test as platform

  6. In this step we need to install node and install the required npm packages as shown below

    Figure 1.6 NPM commands

  7. Now in PC or Mac open command prompt and run the commands as below,

    npm install -g appcenter-cli and setup will be completed and we are ready for uploading the tests to appcenter.

  8. Build the iOS and android apps for the first time and deploy to devices locally(can be automated in complete CI setup)

  9. Run the automation scripts files from local machine or from CI Pipelines

  10. The tests will be uploaded to appcenter and wait for them to finish as shown below

    Figure 1.7 Progress screen for Test run

  11.  The scripts can be uploaded as post build script in visual studio or CI tool to directly upload tests to appcenter.
Reference script
  1. AppCenterAPIToken=’your token’  
  2. AppCenterLogin=’appcenter login — token $AppCenterAPIToken’  
  3. AppCenter_Test_Command=’appcenter test run uitest — app “innovativetechiesltd/AppcenterAppname” — uitest-tools-dir “/Path to solution/packages/Xamarin.UITest.3.0.5/tools” — devices 0e13ce56 — app-path pathToFile.ipa — test-series “master” — locale “en_US” — build-dir pathToUITestBuildDir’  
  4. # Step 1 Provide the (absolute or relative) path to the IPA  
  5. app_path=’/Your path/bin/iPhone/Release/your apkfile.apk’  
  6. # Step 2 Provide the (absolute or relative) path to the UITest project bin folder  
  7. build_dir=’/Your path/Your app.UITests/bin/Release’  
  8. # Step 3 run using the command “sh”  
  9. # Script injects app_path & build_dir and executes resulting command  
  10. AppCenter_Test_Command=${AppCenter_Test_Command/’pathToFile.ipa’/$app_path}  
  11. AppCenter_Test_Command=${AppCenter_Test_Command/’pathToUITestBuildDir’/$build_dir}  
  12. echo $AppCenter_Test_Command  
  13. eval $AppCenterLogin  
  14. eval $AppCenter_Test_Command  
This is a simplest form of uploading tests to app center and may vary with projects and infrastructures.
  1. Refer this beautiful blog for creating the UI tests in c# for Xamarin.
  2. Microsoft documentation
  3. Plural sight course
  4. Github samples