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
相关问题
- Dotnet Core API - Get the URL of a controller meth
- Why am I unable to run dotnet tool install --globa
- Singleton with AsyncLocal vs Scope Service
- Is it possible to pass command-line arguments to @
- What would prevent code running in a Docker contai
相关文章
- DotNet Core console app: An assembly specified in
- EF Core 'another instance is already being tra
- Re-target .NET Core to net471, net 472
- Publishing a Self-contained Console app fails
- Calling a .Net Framework 4 (or Mono) assembly from
- Can't get deleted items from OpenLDAP Server u
- Passing command line arguments to Java via ant bui
- proper way to sign .net core assembly
In addition to Eric’s answer, you can also run
dotnet xunit -xml output.xml
http://xunit.github.io/docs/getting-started-dotnet-core
After stumbling on the same problem (I wanted to publish test results in JUnit format), I ended up finding the JUnitTestLogger NuGet package.
It was a matter of installing it:
And then running the tests as:
You can see all the
dotnet test
options by executingdotnet test --help
. One of the options is-l, --logger
, which gives some great information: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:
Which tells the logger to put the file in the
C:\temp
directory.