首页 > 解决方案 > 如果在容器内运行的集成测试失败,我该如何中断 Azure DevOps 管道?

问题描述

我正在尝试在 Azure DevOps 上创建一个构建管道,它将在 Docker 容器内运行一系列基于Pact .Net的集成测试。

如果这些测试中的任何一个失败,我怎么能打破这个管道?

请注意,测试是在我的容器中的 XUnit 项目中运行的。

标签: .netdockerazure-pipelinesxunitpact

解决方案


尝试使用dotnet testor命令在命令行中运行测试,如果有任何错误写入 StandardError 流vstest.console.exe,我们可以添加以中断管道。failOnStderr: false

container:
  image: xxx/xxx:xxx
  endpoint: 'xxx'

steps:
- script: |
    xxx
  failOnStderr: false

- task: CmdLine@2
  inputs:
    script: |
      xxx
    failOnStderr: true

推荐阅读