This is Syed Aslam Basha here from Information security and risk management team.
Code coverage describes the degree up to which the source code of the program has been tested. The process would involve setting up code coverage and testing the entire application.
You should have pdb files for the DLLs and deployed the bits
Steps to setup code coverage
- Open command prompt in privileged mode
- Change the directory to \Program Files\Microsoft Visual Studio 10.0\Team Tools\Performance Tools\ or C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Performance Tools\x64 for X64 bit setup (OS and VS)
- Instrument application dlls by running the command vsinstr -coverage “…\abc.dll” (Dlls are usually found in bin directory). This step will create backup of original DLL with .orig extension and instruments the dll
- Start coverage monitor by running the command \Program Files\Microsoft Visual Studio 10.0\Team Tools\Performance Tools >start vsperfmon -coverage -output:”D:\xyz.coverage” /CS /user:everyone
- Run your tests(unit test cases/ CUIT /manual) pointing the instrumented bits
- Stop the coverage monitor by running the command vsperfcmd /shutdown
- Open the file xyz.coverage to find your code coverage results.
- The code coverage results would look like, it shows 80% code coverage and 20% code is not covered
– Syed Aslam Basha (firstname.lastname@example.org)
Microsoft Information Security Tools (IST) Team
Please leave a comment if the blog post has helped you.