dotnet test not creating test results folder

你离开我真会死。 提交于 2019-12-05 03:14:05
Andy Li-MSFT

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:


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

e.g.:

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

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

To output the test results using the dotnet test option --results-directory you have to also set --logger.

The -xml and --work options no longer work as they are not part of the options provided by the test CLI. I remember have used -xml in the past and it worked but it doesn't anymore.

You can see all the options for CLI .NET Core 2.x here

To publish the tests results into a specific folder, you should use the command below:

dotnet test --logger "trx;logfilename=mytests.trx" --results-directory ./somefolder/subfolder

Or

dotnet test --logger "trx;LogFileName=./somefolder/subfolder/mytests.trx"

The trx file is a XML file, so you could name it as mytests.xml instead of mytests.trx.

If you use VSTS, you can publish your tests to be shown in your build page using the command above in '.NET Core' task for test and the 'Publish Test Result' task.

The '.NET Core' task explains where it publishes the results as per screenshot below:

Once all done, your build page would look like this:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!