0

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

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

4 Comments

You shouldn’t need to have a manual publish step if you’re using the Azure Devops dotnet task. It pushes it to the test results screen by default.
You are correct! And the screenshot shows that test results were published. I'll update my answer.
@bryanbcook thank you for your comment but no luck after 100% success test cases too. It throws the same error with other .Net Core version also
@bryanbcook Hey I did refresh the pipelines yml file and then solution then tried it worked. So agree with you that failed test cases should not be there for DotNetCoreCLI2 test settings. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.