Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I format Visual Studio Test results file (.trx) into a more readable format?

Have just started using Visual Studio Professional's built-in unit testing features, which as I understand, uses MS Test to run the tests.

The .trx file that the tests produce is xml, but was wondering if there was an easy way to convert this file into a more "manager-friendly" format?

My ultimate goal is to be able to automate the unit-testing and be able to produce a nice looking document that shows the tests run and how 100% of them passed :)

like image 610
PaulStock Avatar asked Aug 22 '08 20:08

PaulStock


People also ask

What is .TRX file?

A trx file is a software developers test results file . . . The file is in XML format, so if you do not have Visual Studio, you can choose to open that in Notepad, it will look something like a tagged html file . . .

How do I open a TRX file in Visual Studio?

From Windows file explorer, drag the TRX file onto the title bar of Visual Studio (the very top of the window). You should then see the file in the "Test results" pane, double click on the test there.

How do I create a TRX file?

To generate a TRX file with SpecFlow+ Runner, you will need to start your tests from the command line using vstest. console.exe with the /logger:trx option to generate a TRX file. You have to execute it in the output folder of your test project ( bin\debug\ ).

How do I run a test file in Visual Studio?

Run tests in Test Explorer If Test Explorer is not visible, choose Test on the Visual Studio menu, choose Windows, and then choose Test Explorer (or press Ctrl + E, T). As you run, write, and rerun your tests, the Test Explorer displays the results in a default grouping of Project, Namespace, and Class.


1 Answers

Since this file is XML you could and should use xsl to transform it to another format. The IAmUnkown - blog has an entry about decoding/transforming the trx file into html.

You can also use .NetSpecExporter from Bekk to create nice reports. Their product also uses XSL, so you could probably steal it from the downloaded file and apply it with whatever xsl-application you want.

like image 105
Espo Avatar answered Sep 22 '22 16:09

Espo