英文:
Statement Coverage vs Call Coverage
问题
好的,以下是翻译好的部分:
大家好,我们在C源代码中使用的一项必需的测试质量指标之一是语句覆盖率和决策覆盖率。由于所使用的测试工具未提供调用覆盖度指标,是否可以提出一个论点,即给定函数的100%语句覆盖度是否意味着在该函数内具有100%的调用覆盖度?
英文:
good day everyone, one of the required test quality metrics that we use for the C-Sources are statement and decision coverage. As the applied test tool does not provide the call coverage metric, can one argument that
100 % statement coverage of the given function implies 100% call coverage within this function ?
答案1
得分: 2
你不能做出那种假设。一个语句可以包括条件调用:
float kelvin = celsius ? c2k(deg) : f2k(deg);
仅仅覆盖这个语句并不能确保所有的调用都被执行。
PS:我曾经争论过,如果有的话,完全条件覆盖(例如100%的MC/DC)将为您提供完全调用覆盖的信心。但我找不到那篇博客文章了。
英文:
You cannot make that assumption. A statement can include conditional calls:
float kelvin = celsius ? c2k(deg) : f2k(deg);
Covering that statement alone will not ensure that all calls are made.
PS: I once argued that that - if anything - full condition coverage (e.g. 100 % MC/DC) would give you the confidence of full call coverage. But I cannot find the blog article anymore.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论