dotnet / xharness

C# command line tool for running tests on Android / iOS / tvOS devices and simulators
MIT License
161 stars 52 forks source link

Support Xamarin.UITest #375

Closed PureWeen closed 1 month ago

PureWeen commented 4 years ago

Archive.zip

The attached project is just a basic sample created from the VS MAC Xamarin.Forms Templates. I've added a cake script so you can run the tests from the command line

Command line

Make sure to startup a single device

dotnet tool install --global Cake.Tool
dotnet cake

Visual Studio

You can also open up the SLN file and run the test via the test runner in VS but just make sure to deploy the app first.

The attached zip currently only works on Android because Xamarin.UITest is broken for Xcode 12.

Once they fix Xcode 12 support I'll update the zip file https://github.com/microsoft/appcenter/issues/2050

premun commented 4 years ago

@PureWeen can you please show me where is the code for the Cake tasks in build.cake? Things like ListAppleSimulators or LaunchiOSApplication

mandel-macaque commented 4 years ago

After taking a quick look, these are the possible steps that we need to take to be able to enable the Xamarin.Forms team to move foward:

iOS

Android

There have been ideas of integration the execution of the nunit runner within xharness vias the NUnit library, there are some thoughts about it:

The problem with this approach is that ATM we do not believe that calabash + XamarinUI tests will be the solution, and others are in the radar, like apium. If that is the case, we should not invest any effort on integrating the runner within xharness because we will have to move to the apium runner and that will be another process. Adding a solution that just calls a process once the app is running might be the best approach knowing the possible future move.

PureWeen commented 4 years ago

@premun

https://github.com/cake-contrib/Cake.AppleSimulator

It looks like most of the commands are built here https://github.com/cake-contrib/Cake.AppleSimulator/blob/beb5e9b60b4d8ea5bbc706d90f67979c634386f0/src/Cake.AppleSimulator/SimCtl/SimCtlRunner.cs#L107

And then they are fed to xcrun https://github.com/cake-contrib/Cake.AppleSimulator/blob/beb5e9b60b4d8ea5bbc706d90f67979c634386f0/src/Cake.AppleSimulator/XCRun/XCRunTool.cs#L82

Pinging @Redth in case he might have additional nuggets of info

The Cake.AppleSimulator bits are purely for spinning up simulators and deploying the app and have nothing to do directly with running the tests. If xHarness can already do all of that then we don't really need to use the Cake.AppleSimulator tools.

ivanpovazan commented 1 month ago

As Xamarin.Forms reached EOL, I am closing this as out of scope.