Exporting an HTML Report From your VS/TFS Test Results

Exporting an HTML Report From your VS/TFS Test Results

Have you ever wanted to export your unit test results from Visual Studio or your TFS Build? Sometimes you may need to provide evidence of your unit testing position to a project stakeholder. This may be for an internal review or as part of a gateway check in a waterfall project. Alternatively you may just want to export your test results for storage later. Out the box Visual Studio provides the Test Results view which is a great tool for seeing the tests that passed/failed in a build, but it is in a custom file format (*.trx) and requires Visual Studio to view.

However I recently found this command line tool on CodePlex by ‘ridomin’ called trx2html which ‘does what it says on the tin’, it converts trx files to HTML. Using the command line, just pass the file path to your test results file for your solution or TFS Build (*.trx) to the trx2html.exe and out pops a fancy HTML report (example below).

trx2html

The tool is open source on CodePlex and so you can download the latest version from: http://trx2html.codeplex.com.

Advertisements

2 thoughts on “Exporting an HTML Report From your VS/TFS Test Results

    1. Hi Yair,
      Once you have set-up and run your unit tests in Visual Studio you should find a .TRX file in your test results folder. Pass the location to the .TRX file on the command line to the trx2html.exe application (e.g: trx2html.exe c:\Code\HelloWorld.trx).
      If you are running VS2012 then a trx file is no longer generated by default. To generate a trx file with VS2012 you will need to use vstest.console. See this stack overflow article. You will also need the version 0.7.3 or later of trx2html
      I hope this helps.
      Rich

Comments are closed.