Code coverage in VS2013 show coverage of Test and

2019-09-21 06:16发布

I am following article for code coverage in VS 2013 http://msdn.microsoft.com/en-us/library/dd537628.aspx. It shows coverage of Test and not actual code.

I have selected unit test from Test explorer and click on Analyze Code Coverage -> Selected Test. Code coverage window is opened up at the bottom and It shows dll of unit test and its coverage and actual dll with code coverage is not shown.

Also, I looked into article http://msdn.microsoft.com/library/jj159523.aspx. Copied pdbs and dll into same location. In the code coverage window message was

Empty results generated: No binaries were instrumented. Make sure the tests ran, required binaries were loaded, had matching symbol files, and were not excluded through custom settings. For more information see http://go.microsoft.com/fwlink/?LinkID=253731"

Any idea about this?

2条回答
相关推荐>>
2楼-- · 2019-09-21 06:58

I have tried steps given in the link.

http://blogs.msdn.com/b/allendm/archive/2012/09/08/empty-coverage-file-with-profiler-related-errors-in-the-event-logs.aspx

Slight change if you are using VS 2013.

a) Environment variable VS120COMNTOOLS is set to \common7\tools

b) Regkey HKLM\SOFTWARE\Microsoft\VisualStudio\12.0\InstallDir is set to your \Common7\IDE\

c) covrun32.dll and covrun64.dll exist in "\Team Tools\Dynamic Code Coverage"

Removed VS110COMNTOOLS environment variable. These changes worked for me.

查看更多
We Are One
3楼-- · 2019-09-21 07:03

I was able to resolve my issue. The reason why code coverage was not happening on my production DLL was: reason = "has_fixed_base". Once I changed this setting to: Yes (/DYNAMICBASE), the coverage started working.

It would help to check these steps:

  1. Open Project Properties
  2. go to Linker->Advanced page
  3. In that, check Randomized Base Address
  4. Change it to Yes (/DYNAMICBASE)

This should start code coverage.

查看更多
登录 后发表回答