I'm new to CI/CD and can't find any information on the internet on how to use AppCenter Test with TFS 2018. I have my Xamarin projects in TFS but I want to test them within the device cloud of AppCenter Test.
There are a couple documents on MS's docs that make it look like it's possible but for a newbie they give ZERO information on how to implement it. HERE is an example. If you look up top this document is relavant to TFS 2018.
Here is what I did to get it working. No idea if it's correct or not, but hey, it works!
If you don't do the following step you'll run your tests locally and nothing will happen, they'll just immediately exit.
First go to Tools > Options > Test > General > Active Solution then uncheck For improved performance, only use test adapters in test assembly folder or as specified in runsettings file
public class AppInitializer
{
public static IApp StartApp(Platform platform)
{
if (platform == Platform.Android)
{
return ConfigureApp.Android
// You may need to adjust the following relative path based on where you created your UITest project
.ApkFile(@"..\..\..\<AppName>\<AppName>.Android\bin\Release\<App Package Name>.apk")
// Uncomment if you are running locally and you want VS to launch/install app
//.PreferIdeSettings()
.StartApp();
}
return ConfigureApp.iOS.StartApp();
}
}
Do not add references to your Android and iOS projects like the MS docs say. This will lead you down the path of hours of useless troubleshooting
Deploy your agent on a development windows box. Follow these instructions: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops
Here are my build steps in detail
version of nuget to install
: 4.9.3
(this is what I noticed my VS was using)restore
**/*.csproj
custom
restore -MsbuildPath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin"
**/*Droid*.csproj
$(build.binariesdirectory)\$(BuildConfiguration)
$(BuildConfiguration)
Specify Location
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin
**/*UITest*.csproj
$(BuildConfiguration)
/p:OutputPath="$(build.binariesdirectory)\$(BuildConfiguration)\test-assembly"
$(build.binariesdirectory)\$(BuildConfiguration)\*.apk
-verbose -sigalg MD5withRSA -digestalg SHA1
10.11.0
Note: Prior to the next step create a new variable called XamarinUITestVer and set the value to whatever value you want to use for the Xamarin.UITest Nuget package you want to install. In my case the value I set was:
2.2.7
custom
install Xamarin.UITest -Version $(XamarinUITestVer) -OutputDirectory "$(Agent.BuildDirectory)\Nuget"
$(build.binariesdirectory)\$(BuildConfiguration)\*.apk
$(Build.ArtifactStagingDirectory)\AppCenterTest
Xamarin UI Test
$(build.binariesdirectory)\$(BuildConfiguration)\test-assembly
$(Agent.BuildDirectory)\Nuget\Xamarin.UITest.$(XamarinUITestVer)\tools\
Run Tests
App Center Connection
New Test Run
, select device(s), select Next
and choose Xamarin.UITest
and hit Next
. Down below you'll see the --app
string and this is what you use for this field.New Test Run
, select device(s), select Next
and choose Xamarin.UITest
and hit Next
. Down below you'll see the --devices
string and this is what you use for this field.