How can I break an Azure DevOps pipeline if integration tests running inside of a container fail?

550 views Asked by At

I'm trying to create a build pipeline on Azure DevOps which is going to run a series of integration tests based on Pact .Net inside of a Docker container.

How can I break this pipeline if any of these tests fail?

Note that the tests are being run inside of an XUnit project in my container.

1

There are 1 answers

0
LoLance On

Try running the tests in Command-line with dotnet test or vstest.console.exe command, then we can add failOnStderr: false to break the pipeline if there's any error written to the StandardError stream.

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

steps:
- script: |
    xxx
  failOnStderr: false

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