I have a hard time finding in docs if I can run the Xamarin UITests on self-hosted windows agent and Azure DevOps build pipelines..
Thanks
I have a hard time finding in docs if I can run the Xamarin UITests on self-hosted windows agent and Azure DevOps build pipelines..
Thanks
I think you can use the appcenter test task, you will need to have node 10 on your agent.
https://learn.microsoft.com/en-us/appcenter/test-cloud/vsts-plugin
After the test is done you need the Publish Test Results task , point it to your xml of results.
Here is what I've tried to do, it is still working in progress. Right now I have problems when the self hosted agent starts the emulator from the script I get Device unauthorized
, but if I start the emulator manually without using the script task pipeline the UITest are executed on the device, so I partially succeded.
What I ended doing:
I installed the Xamarin Build Tools for Visual Studio
Installed a Android Emulator and added the emulator.exe
to my Path environment variable.
Wrote a PowerShell script to start the emulator at the start of my build pipeline.
The build pipeline task:
- task: PowerShell@2
displayName: 'Run Android Emulator'
inputs:
filePath: './run_emulator.ps1'
arguments: '-ExecutionPolicy Unrestricted'
run_emulator.ps1 script:
Start-Process -FilePath "emulator" -ArgumentList "-avd pixel_2_pie_9_0_-_api_28"
- task: XamarinAndroid@1
inputs:
projectFile: '.\tests\TestApp\TestApp.Android\TestApp.Android.csproj'
msbuildArguments: '/t:restore'
jdkOption: 'JDKVersion'
VSTest@2
: - task: VSTest@2
displayName: 'Running UITests for Xamarin'
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\*TestApp.UITests.dll
!*testhost.dll
!**\*testhost.dll
!**\obj\**
!**\xunit.runner.visualstudio.testadapter.dll
!**\xunit.runner.visualstudio.dotnetcore.testadapter.dll
!**\NUnit3.TestAdapter.dll
!**\Xamarin.UITest.dll
searchFolder: './tests/TestApp/'
platform: '$(buildPlatform)'
configuration: '$(configuration)'
I thought that this might help someone trying to accomplish the same thing as me.