Azure Pipelines 在 运行 测试之前单独构建所有项目
Azure Pipelines build all projects individually before running tests
我们有一个应用程序,其中有许多项目在各自的解决方案中相互隔离,每个项目在这些解决方案中都有自己的 UnitTest 和 IntegrationTest 项目。在我们本地托管的 Azure DevOps 应用程序上发生的情况是,以下代码强制 Azure DevOps 在 运行 测试之前构建解决方案中的每个项目。我想做的是 运行 在初始构建上按顺序进行所有测试,或者至少缩短构建时间,因为在构建服务器上,每个构建大约需要一两分钟,这是大部分时间。由于我们有 XUnit 运行 在 say 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)'
What happens on our locally hosted azure devops application is that
the following code below will cause Azure Devops to build each project
in the solution before running tests.
对于这个问题,您可以添加 --no-build
参数以跳过测试时构建的项目 运行。
--no-build
:
在 运行 之前不构建测试项目。这列在 document.
的选项部分
- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: test
projects: '**/*UnitTest*/*.csproj'
arguments: '--configuration $(BuildConfiguration) --no-build'
这里有一个case类似的问题,你可以参考。
我们有一个应用程序,其中有许多项目在各自的解决方案中相互隔离,每个项目在这些解决方案中都有自己的 UnitTest 和 IntegrationTest 项目。在我们本地托管的 Azure DevOps 应用程序上发生的情况是,以下代码强制 Azure DevOps 在 运行 测试之前构建解决方案中的每个项目。我想做的是 运行 在初始构建上按顺序进行所有测试,或者至少缩短构建时间,因为在构建服务器上,每个构建大约需要一两分钟,这是大部分时间。由于我们有 XUnit 运行 在 say 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)'
What happens on our locally hosted azure devops application is that the following code below will cause Azure Devops to build each project in the solution before running tests.
对于这个问题,您可以添加 --no-build
参数以跳过测试时构建的项目 运行。
--no-build
:
在 运行 之前不构建测试项目。这列在 document.
的选项部分- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: test
projects: '**/*UnitTest*/*.csproj'
arguments: '--configuration $(BuildConfiguration) --no-build'
这里有一个case类似的问题,你可以参考。