unit-testing - Azure Pipelines 在运行测试之前单独构建所有项目
问题描述
我们有一个应用程序,该应用程序在自己的解决方案中隔离了许多项目,每个项目在这些解决方案中都有自己的 UnitTest 和 IntegrationTest 项目。在我们本地托管的 Azure DevOps 应用程序上发生的情况是,以下代码强制 Azure DevOps 在运行测试之前构建解决方案中的每个项目。我想做的是在初始构建上按顺序运行所有测试,或者至少缩短构建时间,因为在构建服务器上,每个构建大约需要一分钟或两分钟,这是大部分时间。由于我们让 XUnit 在说 Rider 中运行测试,它可以在一分钟内处理来自多个项目的解决方案中的所有测试。
有没有办法缩短构建时间或者这是否尽可能好?
- task: DotNetCoreCLI@2
displayName: Unit Tests
inputs:
command: test
projects: '**/*UnitTest*/*.csproj'
arguments: '--configuration $(BuildConfiguration)'
# run integration tests
- task: DotNetCoreCLI@2
displayName: Integration Tests
inputs:
command: test
projects: '**/*IntegrationTest*/*.csproj'
arguments: '--configuration $(BuildConfiguration)'
解决方案
在我们本地托管的 azure devops 应用程序上发生的情况是,以下代码将导致 Azure Devops 在运行测试之前构建解决方案中的每个项目。
对于这个问题,您可以添加--no-build
参数以在测试运行时跳过项目构建。
--no-build
:
在运行之前不构建测试项目。这在文档的选项部分中列出。
- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: test
projects: '**/*UnitTest*/*.csproj'
arguments: '--configuration $(BuildConfiguration) --no-build'
这里有一个类似问题的案例,你可以参考一下。
推荐阅读
- c++ - C5002 1204 自动矢量化原因码是什么意思?
- mysql - 休眠不获取非拥有实体
- python - 如何将 Shopify API json 转换为可读的数据框?
- perl - 如何测试模块是否与 Perl 编译器 (perlcc) 兼容?
- node.js - 在aws中部署node js的方式有哪些?
- selenium - Selenium-side-runner 从 cmd 运行特定的 chrome 配置文件
- angular - 未在 chrome 中的禁用元素上引发 Mouseenter 事件
- db2 - 从 DB2 11.1 LUW 生成表 DDL
- c# - LINQ 查询 - 在列表中查找包含具有特定属性的对象的对象
- android - 以编程方式连接到 wifi 网络不允许外部通信