How do I use OpenCover and ReportGenerator to view Unit Test Coverage Results?

后端 未结 4 822
温柔的废话
温柔的废话 2021-01-31 02:52

I\'m a noob to using both OpenCover and ReportGenerator and I\'m struggling a bit in understanding how to get them working. I\'m using VS.NET 2012 \'Professional\' which means I

4条回答
  •  时光说笑
    2021-01-31 03:23

    you do not need to add these to particular project

    I use report generator and open cover to generate test coverage results too. This is the script I use to generate the codecoverage using opencover

    "C:\Program Files (x86)\OpenCover\OpenCover.Console.exe" -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\mstest.exe" -targetargs:"/noisolation /testcontainer:\"C:\\bin\Debug\.dll\" /resultsfile:C:\Reports\MSTest\.trx" -filter:"+[]" -mergebyhash -output:C:\Reports\MSTest\projectCoverageReport.xml

    Note that if your argument needs to escape quotes i.e. to pass arguments with spaces to that target process then you can use ", e.g.: -targetargs:"c:\program files"

    This is the script I use to run report generator.

    C:\ReportGenerator\bin\ReportGenerator.exe -reports:"C:\Reports\MSTest\projectCoverageReport.xml" -targetdir:"C:\Reports\CodeCoverage"

    Hope this helps.

提交回复
热议问题