I need to create some report of the execution of my unit test cases (quantity of tests passed, failed and ignored). I looked around the internet but I didn't find any way to generate this. Does someone knows a simple (or complex) way to generate a unit test report locally? (I said locally because I have found a solution using the test manager but is not feasible to me righ now).
There is no option from the Visual Studio UI, but this can be accomplished from the command line. navigate to your solution directory and run the following command from the Visual Studio 2013 command line:
vstest.console.exe /logger:trx .\TestProject\bin\debug\YourUnitTestAssembly.dll
This will create a TestResults folder under your solution root and drop a .trx file. By opening that file into Visual Studio you should see something like this:
The .trx file is easy to parse XML and can be converted into human readable data using an XSLT, as explained in this other question.
Normally Visual Studio creates this file during the run, but deletes it afterwards. It looks like my instance of Visual Studio will actually create such a trx file and keep it in a $(solutionroot)\TestResults\{GUID}
directory when I use the Analyze code coverage feature:
To see if your version of Visual studio has the Trx
logger installed, run the following command from a Visual Studio command prompt:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With