Statement Coverage vs Call Coverage 语句覆盖 vs 调用覆盖

huangapple go评论62阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年7月4日 21:29:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76613156.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定