I've posted issues in the respective Microsoft Github repositories, but given that they redirected me to Stackoverflow, I'm gonna re-post the question here.
My question is: How to run the automated XCUITests in Microsoft AppCenter from Azure DevOps?
I studied the documentation on how to manually build the app from the console and then upload it to AppCenter (which works). Now I would like to use the official Azure App Center Test task, which should do a similar thing. Unfortunately, these two documentations are significantly different and I have no idea what information I have to provide to that step in order to make it work.
The biggest difference I noticed, is that the AppCenter documentation uses "build-for-testing" and a DerivedData directory where it builds stuff that gets uploaded, whereas the AppCenterTest task requests an IPA, a build directory and a Test IPA path. How to obtain these artifacts?
I tried something like this:
- task: Xcode@5
inputs:
actions: 'clean build test'
configuration: 'Debug'
sdk: 'iphoneos'
xcWorkspacePath: 'MyProject/MyProject.xcworkspace'
scheme: 'MyProject'
packageApp: true
exportPath: '$(build.artifactStagingDirectory)/debug'
signingOption: 'manual'
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)'
destinationPlatformOption: 'iOS'
destinationSimulators: 'iPhone 11'
publishJUnitResults: true
- task: Xcode@5
inputs:
actions: 'build-for-testing'
configuration: 'Debug'
sdk: 'iphoneos'
xcWorkspacePath: 'MyProject/MyProject.xcworkspace'
scheme: 'MyProject'
packageApp: false
args: '-derivedDataPath $(build.artifactStagingDirectory)/DerivedData'
- task: AppCenterTest@1
inputs:
appFile: '$(build.artifactStagingDirectory)/DerivedData/Build/Products/Debug-iphoneos/MyProject.app'
artifactsDirectory: '$(build.artifactStagingDirectory)/AppCenterTest'
frameworkOption: 'xcuitest'
xcUITestBuildDirectory: '$(ProjectDir)/Build/Products/Debug-iphoneos'
xcUITestIpaFile: '$(build.artifactStagingDirectory)/DerivedData/Build/Products/Debug-iphoneos/MyProjectUITests-Runner.app'
credentialsOption: 'serviceEndpoint'
serverEndpoint: 'MyCustomer AppCenter Deployment'
appSlug: 'MyCustomer/MyProject-iOS'
devices: 'iphoneDevices'
localeOption: 'en_US'
skipWaitingForResults: true
but I'm getting an error similar to ##[error]Error: Cannot find any file based on /Users/runner/runners/2.163.1/work/1/a/DerivedData/Build/Products/Debug-iphoneos/MyProject.app
Does anyone have a full working example and could provide an example YAML file that:
- Builds a native iOS app with XCode that has at least one UI test
- Uploads the app to AppCenter and runs that UI test on a real device
We ended up with the following build script that actually works. Please note, that you can't combine steps arbitrarily, as
xcode build-for-testingdoes not allow providing signing certificates and thus cannot be combined withpackageApp: true