如何配置azure管道以仅重试失败的测试

问题描述 投票:0回答:1

我有一个运行大量测试的管道。我正在使用 retryCountOnTaskFailure 但我遇到的问题是有时 1 个片状测试失败,任务重新运行,但它再次运行所有测试,包括所有通过的测试。不理想。

有解决办法吗?

谢谢。

.net azure-devops azure-pipelines
1个回答
0
投票

retryCountOnTaskFailure
的功能只会使管道重新运行整个失败的步骤。如果使用
VSTest
管道任务进行测试,您可以使用此任务的
Rerun failed tests
功能,而不是重新运行测试步骤。

从下面的示例中我们可以看到,在我的

VSTest
步骤中有 2 个测试;一项测试通过,另一项测试失败;在接下来的尝试中,仅执行失败的测试。

- task: VSTest@3
  inputs:
    testSelector: 'testAssemblies'
    testAssemblyVer2: |
      **\*test*.dll
      !**\*TestAdapter.dll
      !**\obj\**
    searchFolder: '$(System.DefaultWorkingDirectory)'
    rerunFailedTests: true
    rerunFailedThreshold: '90'
  displayName: VS Test

© www.soinside.com 2019 - 2024. All rights reserved.