why code coverage result is different in debug and release versions in visual studio

时间:2018-06-20 05:04:41

标签: visual-studio unit-testing code-coverage release pki

Am working in Visual Studio 2013.

My Build and Running UT is successful.

But when i see code coverage results, Debug version is showing 83% and Release version is 70 %.

Why so much of difference is coming and whats the solution?

1 个答案:

答案 0 :(得分:0)

编译要发布的代码意味着编译器将执行更具侵略性的优化,例如内联函数,修剪无法访问的路径等。这通常意味着最终可执行文件中的代码更少。

如果此代码“删除”大部分发生在代码覆盖率较高的区域,而很少发生在代码覆盖率较低的区域,则总体覆盖率将降低。