管道:.NETCORECLI测试任务引发非零错误

发布于 2025-02-06 18:40:37 字数 669 浏览 3 评论 0原文

我已经为.NET 5 API项目和Xunit测试项目使用了以下YML命令,但是它会引发错误,并且我的管道没有成功。我哪里出错了?

注意:即使执行了测试用例并显示了15例测试用例,并提交了2例测试用例,即使执行了测试案例,管道也不会成功。

- 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'

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

新一帅帅 2025-02-13 18:40:37

您正在使用dotnetCorecli@2任务,该任务在测试失败时总是会失败。那是设计:失败的测试应破坏构建。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文