我有一个以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命令发布结果
发布评论