xunit.testlogger icon indicating copy to clipboard operation
xunit.testlogger copied to clipboard

how it works?

Open AmeerMansourBeca opened this issue 2 years ago • 2 comments

sorry but i didn't understand this point

Use the following command line in tests dotnet test --logger:xunit Test results are generated in the TestResults directory relative to the test.csproj A path for the report file can be specified as follows:

dotnet test --logger:"xunit;LogFilePath=test_result.xml"

can I use it to automatically generate reports automatically after my tests run?

AmeerMansourBeca avatar Jun 11 '22 13:06 AmeerMansourBeca

Yes, you use the test_results.xml file as the input into a tool of your choice that can generate reports. One example of this is if you are using Jenkins for your builds, you can use this jenkins plugin to display the results based on the test_results.xml file. https://plugins.jenkins.io/xunit/

crainey avatar Jun 21 '22 13:06 crainey

@AmeerMansourBeca Yeah, thats right. After you add the nuget package to your test project, use the command line in the directory with your test csproj to run dotnet test --logger:xunit. You will see in the console where your report was written.

As @crainey said, you can run the same command in your CICD pipeline and then have the xml file saved into whatever system you are using.

Siphonophora avatar Jun 22 '22 22:06 Siphonophora

Closing due to inactivity. Please reopen as appropriate.

codito avatar Jul 05 '23 05:07 codito