git - 在 Azure DevOps 中对 pull 请求运行选择性测试用例

标签 git azure-devops azure-pipelines

我们在项目中设置了一个流程,用于在将代码从功能分支 merge 到开发或主分支时创建 pull 请求(PR)。 PR 不会完成,除非 CI 成功并且应用程序中的所有测试用例都成功运行。然后 SonarQube 使用测试用例执行报告来发布代码覆盖率。 SonarQube 配置为仅发布新代码行的报告。

目前这些测试用例(单元测试用例)需要大约 2-2.5 小时才能完成,有效地延迟了 PR 的完成。因此,我们正在考虑一些解决方法,作为 PR CI 的一部分,我们可以仅运行受影响的测试用例。这在 Azure DevOps 中可能吗?

最佳答案

您正在寻找测试影响分析。请阅读the docs ,但基本上:

TIA performs incremental validation by automatic test selection. It will automatically select only the subset of tests required to validate the code being committed. For a given code commit entering the CI/CD pipeline, TIA will select and run only the relevant tests required to validate that commit. Therefore, that test run will complete more quickly, if there is a failure you will get to know about it sooner, and because it is all scoped by relevance, analysis will be faster as well.

您只需在 Visual Studio 测试任务中启用它即可:

enter image description here

关于git - 在 Azure DevOps 中对 pull 请求运行选择性测试用例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63660459/

相关文章:

git - 源代码树 - 删除、丢弃、忽略之间有什么区别?

git - Azure 云服务和 Git 持续部署?

azure-devops - 如何在 Azure DevOps 中启用 Docker 层缓存

azure-devops - 在构建任务中强制执行 PowerShell

c# - dotnet build xamarin 项目使用控制台失败

git - 如何在没有 git clean 的情况下删除 GIT 中未跟踪的文件

git 显示一个不存在的奇怪文件名

azure - 使管道任务在所有作业后任务之后运行

azure-devops - 重命名 Azure DevOps 托管代理

azure - 新镜像未部署到 AKS