【问题标题】:How do you run xcuitests in parallel using azure dev Ops?如何使用 azure devOps 并行运行 ui 测试?
【发布时间】:2020-01-03 13:56:53
【问题描述】:

我想使用 xcode 的开箱即用功能在 azure dev ops 上并行执行我的 xcuitest 套件。在本地,只需选中复选框即可在我的测试目标上启用并行测试。

Parallel executions toggle

在本地,xcode 打开多个模拟器,测试按预期运行。在 azure 上,它们按预期运行和通过,但它们花费的时间与通常相同,这向我表明它们没有并行运行。我在这里想念什么?我需要采取额外的步骤来让它们通过 azure dev ops 并行运行吗?

Azure-Pipleline.yml sn-p

 - 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 sn-p

 - 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

【问题讨论】:

  • 只是想确认matrix是否可以让你实现xcuitest的类似功能?如果您有任何困惑,请随时发表评论。

标签: xcode azure-devops xcuitest parallel-testing


【解决方案1】:

您可以考虑使用build matrix,这是YAML的一项功能,可以实现多模拟器运行测试:

jobs:
- job: Build
  strategy:
    matrix:
      simulators1:
        destinationSimulators: 'iPhone X'
      simulators2:
        destinationSimulators: 'iPhone 7'


..
..
- task: Xcode@5
   displayName: "Run Tests"
..
..
  destinationSimulators: "$(destinationSimulators)"
..
..

【讨论】:

    猜你喜欢
    • 2021-01-05
    • 2023-02-26
    • 2022-08-18
    • 2021-06-16
    • 2020-12-24
    • 1970-01-01
    • 2021-07-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多