Home > OS >  Pipeline: .NetCoreCLI Test Task throws non-zero error
Pipeline: .NetCoreCLI Test Task throws non-zero error

Time:06-13

I have used the following yml command for my .Net 5 API project and xUnit Test Project but it throws error and my pipeline is not getting succeeded. Where did I go wrong?

Note: The pipeline is not getting succeded even if the task executed the test cases and showing 15 test cases passed and 2 test cases are filed.

- task: DotNetCoreCLI@2
   inputs:
       command: 'restore'
       projects: '**/GeniusData.Test/GeniusData.Test.csproj'
     displayName: 'Restore Projects'

- task: DotNetCoreCLI@2
 inputs:
  command: test
  projects: '**/*Test/*.csproj'
  arguments: '--configuration $(buildConfiguration) --collect "Code coverage"'
 displayName: 'Test Project'

enter image description here

CodePudding user response:

You're using the DotNetCoreCLI@2 task which will always fail when tests fail. That's by design: failing tests should break the build.

  • Related