3

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?

Karma Yogi
  • 615
  • 1
  • 7
  • 18

1 Answers1

3

Compiling code for release means that the compiler will perform much more aggressive optimizations, such as inlining functions, trimming unreachable paths, etc.. This will often mean you're left with less code in the final executable.

If this code "removal" happens mostly in areas of the code that happen to be well covered and less in areas of the code that are less covered, the overall coverage will be reduced.

Mureinik
  • 297,002
  • 52
  • 306
  • 350
  • Any idea how to improve release code coverage? Any changes in visual studio settings and optimization options ? – Karma Yogi Jun 20 '18 at 07:57