3
votes

I have downloaded and installed OpenCoverUI in VisualStudio Community 2015. I have written unit tests. When I execute open cover from visual studio I get OpenCover Results with code coverage in visual studio. But Now I want generate a HTML Report from this code coverage.I am using this ReportGenerator from https://github.com/danielpalme/ReportGenerator/.To generate a coverage report with ReportGenerator the file has to be converted to *.xml format. I also tried using OpenCover.Console.exe but I am getting error. Using OpenCover UI was easier. where can i find the xml file? Or how do i generate the xml file? Please help me I am stuck!.Using this refernece https://bearandhammer.net/2017/02/12/opencover-ui-unit-test-code-coverage/...This is the command I tried from command prompt :

    C:\Users\AppData\Local\Apps\OpenCover>OpenCover.Console.exe -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" 
-targetargs:"/noisolation /testcontainer:\" D:\TicTacToeLibTests\bin\Debug\TicTacToeLibTests.dll" /resultsfile:D:\Reports\MSTest\.trx"
 -mergebyhash -output: D:\OpenCoverExample\coverage.xml
1

1 Answers

1
votes

Well after trying for hours it worked. This youtube link was useful.Code coverage with OpenCover Console and ReportGenerator -https://www.youtube.com/watch?v=0UJNYrhH05w .I used the same versions as mentioned in this youtube example

OpenCover.Console.exe -target:"D:\Project\packages\NUnit.ConsoleRunner.3.6.0\tools\nunit3-console.exe"
-targetargs:"D:\Project\NUnit.Tests1\bin\Debug\NUnit.Tests.dll" 
-output:"D:\Project\TestResults\coverage.xml" -register:user 


ReportGenerator.exe -reports:"D:\Project\TestResults\coverage.xml" 
-targetdir:"D:\Project\TestResults\report"