Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2012 Unit Test Report

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).

like image 800
Otávio Pereira Avatar asked Feb 10 '23 16:02

Otávio Pereira


1 Answers

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:

enter image description here

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:

enter image description here

enter image description here

To see if your version of Visual studio has the Trx logger installed, run the following command from a Visual Studio command prompt:

enter image description here

like image 110
jessehouwing Avatar answered Feb 23 '23 04:02

jessehouwing