在(A || B)上执行MCDC覆盖范围需要多少个测试用例

发布于 2025-02-01 16:07:44 字数 73 浏览 1 评论 0原文

我研究了测试案例的数量应为 n+1 , 其中 n 是变量的数量。

I studied that the number of test case should come out to be n+1,
where n is the number of variables.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

幻想少年梦 2025-02-08 16:07:44

当A为真时,未评估B,因此不会影响结果,因此所有具有A = true的决策都是一个测试案例。当A为错误时,B的两个状态都会影响结果,因此总共需要三个测试用例。

现在,是否可以将其推广到n+1,这并不能真正由上述证明,但这不是您所要求的 - 您只是说明了这一点。但是,如果您考虑B表示子表达C || D的情况,需要三个REST病例,则在A为TRUE的测试,即四个测试用例(即N+1)。

因此,要概括任何表达式:

<condition>||<decision>

测试用例的数量是:

1 + test_cases(<decision>)

When A is true, B is not evaluated so does not affect the outcome, so all decisions with A=true are one test case. When A is false both states of B affect the outcome, so in total it requires three test cases.

Now whether that can be generalised to n+1 is not really proven by the above, but that is not what you have asked - you merely stated that. However, if you consider the case where B represents a sub-expression C||D, requiring three rest cases, then the test where A is true, that is four test cases (i.e. n+1).

So to generalise for any expression:

<condition>||<decision>

the number of test cases is:

1 + test_cases(<decision>)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文