[英]How do you run xcuitests in parallel using azure dev Ops?
我想使用 xcode 的開箱即用功能在 azure dev ops 上並行執行我的 xcuitest 套件。 在本地,就像選中復選框以在我的測試目標上啟用並行測試一樣簡單。
在本地,xcode 打開多個模擬器並且測試按預期運行。 在 azure 上,它們按預期運行和通過,但它們花費的時間與通常相同,這向我表明它們不是並行運行的。 我在這里缺少什么? 我是否需要采取額外的步驟來讓它們通過 azure dev ops 並行運行?
Azure-Pipleline.yml 片段
- stage: uiTests
displayName: UI Tests
dependsOn: []
condition: | # don't run for release builds to save Azure bandwith
not(
or(
contains(variables['Build.SourceBranch'], 'master'),
contains(variables['Build.SourceBranch'], 'release')
)
)
jobs:
- template: azure-templates/job-tests.yml
parameters:
configuration: "$(UI_TEST_CONFIGURATION)"
sdk: "$(UI_TEST_SDK)"
scheme: "$(UI_TEST_SCHEME)"
artifactName: "UI Tests Results - Attempt #$(System.StageAttempt).$(System.JobAttempt)" # include attempt number in suffix because reruns can not overwrite artifacts"
shouldRunWiremock: true
azure-templates/job-test.yml 片段
- job: Test
pool: Hosted macOS
variables:
- template: variables.yml
- group: blah-Keys
steps:
- template: steps-install-code-signing.yml
parameters:
certFile: "$(UAT_SIGNING_FILE_ID)"
signingIdentity: "$(UAT_SIGNING_IDENTITY)"
provisioningFile: "$(UAT_PROVISIONING_FILE_ID)"
- script: "./setBuildVersion.sh"
displayName: "Update Build Number"
- script: "./xcconfig.sh"
displayName: "Populate xcconfig files"
- bash: "./runWiremock.sh &"
continueOnError: true
displayName: "Start Mock Server"
enabled: ${{ parameters.shouldRunWiremock }}
- task: Xcode@5
displayName: "Run Tests"
inputs:
actions: test
configuration: "${{ parameters.configuration }}"
sdk: "${{ parameters.sdk }}"
xcWorkspacePath: "$(WORKSPACE_PATH)"
scheme: "${{ parameters.scheme }}"
xcodeVersion: specifyPath
xcodeDeveloperDir: "$(XCODE_PATH)"
signingOption: default
args: "-resultBundlePath $(build.SourcesDirectory)/testResults"
destinationPlatformOption: iOS
destinationSimulators: "$(TEST_SIMULATOR)"
publishJUnitResults: true
continueOnError: false # report test failures as errors in Azure DevOps
- publish: testResults
artifact: "${{ parameters.artifactName }}.xcresult"
condition: not(canceled()) # run if there are test failures
您可以考慮使用構建矩陣(YAML 的一項功能)來實現使用多個模擬器運行的測試:
jobs:
- job: Build
strategy:
matrix:
simulators1:
destinationSimulators: 'iPhone X'
simulators2:
destinationSimulators: 'iPhone 7'
..
..
- task: Xcode@5
displayName: "Run Tests"
..
..
destinationSimulators: "$(destinationSimulators)"
..
..
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.