Xcode 如何使用azure开发人员操作并行运行XSuite测试?
我想使用xcode的开箱即用功能在azure开发人员操作系统上并行执行我的XUITest套件。在本地,只需选中复选框即可在我的测试目标上启用并行测试 在本地,xcode打开多个模拟器,测试按预期运行。在azure上,它们按预期运行并通过,但它们所用的时间与通常相同,这向我表明它们不是并行运行的。我错过了什么?我是否需要采取额外的步骤来通过azure开发运营使它们并行运行 Azure-Pipleline.yml代码段Xcode 如何使用azure开发人员操作并行运行XSuite测试?,xcode,azure-devops,xcuitest,parallel-testing,Xcode,Azure Devops,Xcuitest,Parallel Testing,我想使用xcode的开箱即用功能在azure开发人员操作系统上并行执行我的XUITest套件。在本地,只需选中复选框即可在我的测试目标上启用并行测试 在本地,xcode打开多个模拟器,测试按预期运行。在azure上,它们按预期运行并通过,但它们所用的时间与通常相同,这向我表明它们不是并行运行的。我错过了什么?我是否需要采取额外的步骤来通过azure开发运营使它们并行运行 Azure-Pipleline.yml代码段 - stage: uiTests displayName: UI Tests
- 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
- 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
azure模板/job-test.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
- 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)"
..
..
只是想确认matrix是否可以为您提供类似XCuTest的功能?如果您有任何困惑,请随时发表评论。