How do code coverage tools work?

前端 未结 5 1308
小蘑菇
小蘑菇 2021-01-30 08:43

How do code coverage tools like NCover know what parts of the code were executed and what parts were not?

5条回答
  •  遥遥无期
    2021-01-30 09:10

    Quote straight from the NCover FAQ: NCover reports the percentage of branches in the code that have been taken throughout the course of your automated testing. It achieves this by instrumenting the source code at each branch, and writing the 'hit' points to a file. These 'hit' points are then compared to the total possible points that could have been 'hit'.

提交回复
热议问题