在(A || B)上执行MCDC覆盖范围需要多少个测试用例
我研究了测试案例的数量应为 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当A为真时,未评估B,因此不会影响结果,因此所有具有A = true的决策都是一个测试案例。当A为错误时,B的两个状态都会影响结果,因此总共需要三个测试用例。
现在,是否可以将其推广到n+1,这并不能真正由上述证明,但这不是您所要求的 - 您只是说明了这一点。但是,如果您考虑B表示子表达C || D的情况,需要三个REST病例,则在A为TRUE的测试,即四个测试用例(即N+1)。
因此,要概括任何表达式:
测试用例的数量是:
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:
the number of test cases is: