Miaz
Miaz

Reputation: 1

How to run Xamarin.UITests for iOS with Visual Studio on a Mac

I am writing automated UI tests for a Xamarin.Forms crossplattform App. I have already implemented tests for Android using Xamarin.UITests to run them in the App Center. Now I want to execute these tests for iOS as well and I have already figured out that this isn't possible on Windows. So I switched to Visual Studio on a Mac. The documentation of Xamarin.UITest gives an instruction how to run tests with Xamarin.UITest via XCode using Calabash (https://learn.microsoft.com/en-us/appcenter/test-cloud/frameworks/uitest/ios/) but I was not able to figure out how I can use this information for the project I've already implemented in Visual Studio.

Any suggestion, idea or approach how I can run UITests for a Xamarin.Forms Application on iOS via Visual Studio on a MAC? Is it even possible? I would be very thankful for any advice.

Upvotes: 0

Views: 1198

Answers (2)

Miaz
Miaz

Reputation: 1

I've solved the problem by basically following these steps on MacOS with Visual Studio for Mac: https://learn.microsoft.com/en-us/appcenter/test-cloud/frameworks/uitest/ios/upload

  1. Add Xamarin Test Cloud Agent package to the iOS project
  2. Edit the AppDelegate class and add the following snippet to the FinishedLaunching method: Xamarin.Calabash.Start(); Follow these steps: https://learn.microsoft.com/en-us/appcenter/test-cloud/frameworks/uitest/ios/simulator?tabs=vsmac

I have been confused by the documentation but this works fine for me now.

Upvotes: 0

Hemalatha M.R.
Hemalatha M.R.

Reputation: 124

This configuration only differs in the AppInitializer file.

 public static IApp StartApp(Platform platform) 
{ 
     return ConfigureApp.iOS 
                               .EnableLocalScreenshots() 
                               .DeviceIdentifier("4C379ADB-648B-4683-9B85-A96E9162A38C") 
                               .InstalledApp("com.MyProject.SampleUITesting") 
                               .StartApp(); 

}

Here, 4C379ADB-648B-4683-9B85-A96E9162A38C - defines your simulator id. You can get that by using

enter image description here

Which is in the Xcode Window menu, select Devices, and Simulators.

InstalledApp("com.MyProject.SampleUITesting") - Defines your package name.

Upvotes: 2

Related Questions