I'd like to be able to produce a HTML based report from the Results.trx
and data.coverage
files that MSTest creates. Ideally this would just list any failures, and show some basic coverage stats.
Does anyone know of a tool that does this?
I'd like to be able to produce a HTML based report from the Results.trx
and data.coverage
files that MSTest creates. Ideally this would just list any failures, and show some basic coverage stats.
Does anyone know of a tool that does this?
you can use TRXER tool to generate HTML reports from trx file. Download TrxerConsole.exe file from here
C:\Users\NAME\source\repos\UnitTest1 \UnitTest1 \bin\Debug\netcoreapp3.1\UnitTest1.dll
cd C:\Users\NAME\source\repos\UnitTest1\UnitTest1\bin\Debug\netcoreapp3.1\UnitTest1.dll
vstest.console.exe UnitTest1.dll /logger:trx
Trx file will be generated in the folder TestReults which is present in the same location where project dll file is present.
If TrxerConsole.exe is in downloads then run the command to convert into HTML.
Path of trxerconsole.exe file then space then Path of trxfile as below
C:\Users\NAME\Downloads\TrxerConsole.exe C:\Users\NAME\source\repos\DesktopWithMSTest\DesktopWithMSTest\bin\Debug\netcoreapp3.1\TestResults\TestResult.trx
link to refer
your Reports will look like:
Actually we did that using the open source tool Trx2Html
Its really simple - gets trx file and output html. There are specific versions for VS2005 trx and VS2008 trx.
You can publish to the report server and then the reports will be available from a web interface.
( I did it in PowerShell)
You need this dll
Microsoft.VisualStudio.Coverage.Analysis.dll
then this line will turn .coverage into an xml file (which the .trx already is)
$dataStore = ([Microsoft.VisualStudio.CodeCoverage.CoverageInfoManager]::CreateInfoFromFile("$homeDir\tests.coverage")).BuildDataSet($null)
$dataStore.WriteXml("$homeDir\Coverage.xml")
Then you could use the MsTest xsl file from cruisecontrol.net to put the test results in a nice html format, and I have an XSL for the coverage. WHich won't fit here. I wish they had a way to upload files. Email me alex dot hutton at hotmail, and I can get you the xsl to display that coverage
The trx files are fairly simple xml documents that can easily be processed with XSLT to produce flexible and customized reports.
If you google trx and xslt you'le find a number of examples to get you started.
I have added a codeplex project for this, you can generate the html from trx as well as add code-coverage data to the same report. http://trxtohtml.codeplex.com/
try the new trx2html.codeplex.com it's not based on XSLT, but in LINQ2XML so it's easier to extend
I am writing a simple batch file to convert your XML report into HTML
Create a report.bat file and paste the code given below
@echo off
::*****************************Constants*****************************************************************
set "trxFileName=TestResult"
set "trx2html_path=C:\Users\Desktop\0.6\TrxerConsole.exe"
::********************************************************************************************
echo ------------------------"Generating test report "---------------------------------------------- %trx2html_path% ".\Results\%trxFileName%"
echo -----------------------"Test Report Generated at location=.\Results\%trxFileName%"------------ pause
I have created a tool to generate html from trx. The tool is available from Nuget.org.
Install as global tool:
dotnet tool install --global trxlog2html --version 1.0.0
Install as local tool:
dotnet new tool-manifest
dotnet tool install --local trxlog2html --version 1.0.0
Converting the TRX to html file:
After installation, you can convert the trx file to html file with the following command.
dotnet run trxlog2html -i [input trx file path] -o [output html file path]
See the links below for more information.
© 2022 - 2024 — McMap. All rights reserved.