I have been trying to get code coverage of my web application using OpenCover. We have automated tests using Selenium Webdriver written in MSTest. Planning to get code coverage of my web application using automated tests
I tried below commands, but no luck. as per the documentation, we need to stop the w3svc
service, which would eventually stop the IIS. And when I trigger automated scripts the page loads with Not found
.
OpenCover.Console.exe "-target:C:\Windows\System32\inetsrv\w3wp.exe" "-targetargs:-debug" "-targetdir:C:\inetpub\wwwroot\OpenCover\bin\" -register:administrator -output:C:\OpenCover.results.xml
OUTPUT: Committing... No results, this could be for a number of reasons. The most common reasons are: 1) missing PDBs for the assemblies that match the filter please review the output file and refer to the Usage guide (Usage.rtf) about filters. 2) the profiler may not be registered correctly, please refer to the Usage guide and the -register switch.
OpenCover.Console.exe -target:"Path to MSTest\mstest.exe" -targetargs:"/noisolation /testcontainer:\"Path to Selenium Tests\bin\Debug\OpenCoverSeleniumTest.dll\" /resultsfile:C:\OpenCover.trx" -targetdir:C:\inetpub\wwwroot\OpenCover\bin\ -filter:+[*]* -register:administrator -output:C:\OpenCover1.results.xml
OUTPUT: Committing... Visited Classes 1 of 1 (100) Visited Methods 5 of 5 (100) Visited Points 24 of 24 (100) Visited Branches 5 of 5 (100)
==== Alternative Results (includes all methods including those without corresponding source) ==== Alternative Visited Classes 1 of 1 (100) Alternative Visited Methods 6 of 6 (100) The above output is for test automation code coverage but not for the application code coverage.
For point 1: I have PDB files in the bin folder.
I have read the OpenCover
documentation but couldn't figure out. Any working solution or guidelines to the same are much appreciated.
Thanks, Sham