如何使用dotnet test命令发布结果

编程入门 行业动态 更新时间:2024-10-25 08:24:36
本文介绍了如何使用dotnet test命令发布结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个以dotnet核心编写的测试项目。这需要以XML或HTML格式发布结果。有没有办法我可以使用同一命令将结果发布到特定目录? -结果目录对我不起作用

I have a test project written in dotnet core. This need to publish the results in an XML or HTML format. Is there a way I can publish the results to a particular directory using the same command? --result-directory is not working for me

推荐答案

通过执行<$ c $,您可以看到所有 dotnet测试选项。 c> dotnet测试--help 。选项之一是 -l --logger ,它提供了一些重要信息:

You can see all the dotnet test options by executing dotnet test --help. One of the options is -l, --logger, which gives some great information:

Specify a logger for test results. Examples: Log in trx format using a unqiue file name: --logger trx Log in trx format using the specified file name: --logger "trx;LogFileName=<TestResults.trx>" More info on logger arguments support:aka.ms/vstest-report

该支持链接 aka.ms/vstest-report 具有完整的信息。

That support link aka.ms/vstest-report, has the full information.

所以要回答您的特定问题,您可以说

So to answer your specific question, you can say

dotnet测试-l:trx ; LogFileName = C:\temp\TestOutput.xml

要将结果发布到特定目录。

To publish the results to a particular directory.

另一种方法是在test.csproj中设置MSBuild属性:

Another option is setting MSBuild properties in your test.csproj:

<PropertyGroup> <VSTestLogger>trx</VSTestLogger> <VSTestResultsDirectory>C:\temp</VSTestResultsDirectory> </PropertyGroup>

告诉记录器将文件放入 C:\temp 目录。

Which tells the logger to put the file in the C:\temp directory.

更多推荐

如何使用dotnet test命令发布结果

本文发布于:2023-11-10 09:29:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1575005.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   命令   dotnet   test

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!