How to publish results using dotnet test command

前端 未结 3 1773
后悔当初
后悔当初 2021-02-01 16:14

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

3条回答
  •  野的像风
    2021-02-01 17:00

    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="
    More info on logger arguments support:https://aka.ms/vstest-report
    

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

    So to answer your specific question, you can say

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

    To publish the results to a particular directory.

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

    
      trx
      C:\temp
    
    

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

提交回复
热议问题