dotnet测试未创建测试结果文件夹 [英] dotnet test not creating test results folder

查看:70
本文介绍了dotnet测试未创建测试结果文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为我们的 ASP.NET Core 2.0 构建过程的一部分,我添加了 dotnet test 命令,该命令已作为Windows批处理文件添加.

As part of our ASP.NET Core 2.0 build process I have added a dotnet test command which I have added as a Windows batch file.

这是我的命令.

dotnet test "MyProject.csproj" --no-restore --results-directory "MyProject\TestResults" --verbosity minimal

这是从命令行运行时的输出.

And here is the output when run from the command line.

因此,这一切似乎都可以正常工作,但是没有创建测试结果/测试输出.

So it all appears to work correctly, yet no test results / test output is created.

推荐答案

要从dotnet测试输出测试结果,您可以尝试通过-xml /some/path/out.xml或使用work参数,例如:dotnet test --work:"mypath/myresult.xml".有关详细信息,请参见以下线程:

To output the test results from dotnet test, you can try pass -xml /some/path/out.xml or use the work parameter, like this: dotnet test --work:"mypath/myresult.xml". See below threads for details:

  • dotnet test - Output test results
  • Is there a way to specify TestResult.xml location?

此外,通常需要指定参数-l|--logger <LoggerUri/FriendlyName>,该参数指定测试结果的记录器.

Besides, generally you need to specify the argument -l|--logger <LoggerUri/FriendlyName> which specifies a logger for test results.

例如:

dotnet test "myproject.csproj" --logger "trx;LogFileName=path\to\tests\folder\results.trx"dotnet test "myproject.csproj" -l:"trx;LogFileName=path\to\tests\folder\results.trx"

要将生成的trx文件用作VSTS/TFS中的测试结果,可以使用发布测试结果"任务:

To make the generated trx files available as test results in VSTS/TFS, you can use the "Publish Test Results" task:

这篇关于dotnet测试未创建测试结果文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆