【问题标题】:Visual Studio Team Server CI run .NET Core xUnit test FaileVisual Studio Team Server CI 运行 .NET Core xUnit 测试失败
【发布时间】:2018-09-05 17:05:36
【问题描述】:

我已阅读xUnit getting test results in vsts

在 build 之后,它运行我的测试,并显示所有测试用例通过。

但是任务失败了,我从日志中找不到任何原因。

vstest.console.exe 
"D:\a\1\s\Services\AuthManagement\XXXX.Management.Api.Test\bin\Release\netcoreapp2.1\XXXX.Management.Api.Test.dll"
"D:\a\1\s\Services\AuthManagement\XXXX.Management.Api.Test\obj\Release\netcoreapp2.1\XXXX.Management.Api.Test.dll"
/EnableCodeCoverage
/logger:"trx"
/TestAdapterPath:"D:\a\1\s"
/InIsolation

我在本地nb运行这个命令,没有任何错误。

在vsts中有错误信息

System.IO.FileNotFoundException: Unable to find tests for D:\a\1\s\Services\AuthManagement\XXXX.Management.Api.Test\obj\Release\netcoreapp2.1\XXXX.Management.Api.Test.dll. Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk" and framework version settings are appropriate. Rerun with /diag option to diagnose further.

XXXX.Management.Api.Test 项目,已经安装了 Microsoft.NET.Test.Sdk nuget 包

【问题讨论】:

  • 当你使用 /diag 运行时会发生什么?
  • 为了调试,请在构建之前插入一个nuget restore任务,看看这个任务是否成功。

标签: asp.net-core azure-devops xunit


【解决方案1】:

根据报错信息,查找obj/release文件夹中的文件,应该是exclude,所以你可以添加!**\obj\**来排除obj文件夹中的文件。例如;

**\*xUnitTest*.dll
!**\obj\**

【讨论】:

    猜你喜欢
    • 2017-05-30
    • 1970-01-01
    • 2020-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多