问题描述
我遇到一种情况,我需要编写一些测试用例才能完全覆盖代码。
在一个垂直分支处,我遇到以下情况
if(((A&& B&& C)|| D)
I have a situation where I need to write few test cases to get complete coverage of the code.At a perticular branch I got following situation if((A && B && C) || D)
if((A && B && C) || D)
{
//perform task 1'
}
else
{
//perform task 2;
}
但是,我无法获得MCDC的测试用例组合。 b $ b可能是这里的出路...
But with this I am unable to get test case combination for MCDC..What could be the way out here...
推荐答案
您的出路可能是使用工具来识别可能的测试用例。
Your way out could be to use the tool MCDC to identify possible test cases.
很抱歉,我无法共享研究的所有细节,因此手动进行这项工作实际上可能是很多工作。我建议从阅读FAA(DOT / FAA / AR-01 / 18)出版的对三种形式的条件变更条件决策覆盖率(MCDC)标准的调查开始。
I am sorry that I cannot share all the details of my research. I would recomend to start with reading "An Investigation of Three Forms of the Modified Condition Decision Coverage (MCDC) Criterion", published by the FAA (DOT/FAA/AR-01/18).
包括掩蔽在内,有52个可能的测试对。如果您进行了正确的WhiteBox分析(包括布尔快捷方式评估),那么您甚至可以找到63个MCDC测试对。采用集合覆盖算法将产生3个可能的最小测试集。
Including Masking there are 52 possible test pairs. If you do a proper WhiteBox Analysis, including boolean short cut evaluation, then you will find even 63 MCDC test pairs. Apllying the set cover algorithm will result in 3 possible minimum test sets.
进行一些启发式测试可能会得出令人惊讶的测试向量:
Doing some heuristics will lead to the maybe surprising test vector:
Test Pair for Condition 'a': 0 14 (Unique Cause)
Test Pair for Condition 'b': 8 14 (Unique Cause)
Test Pair for Condition 'c': 12 14 (Unique Cause)
Test Pair for Condition 'd': 0 1 (Unique Cause)
测试向量:推荐结果:0 1 8 12 14
Testvector: Recommended Result: 0 1 8 12 14
0: a=0 b=0 c=0 d=0 (0)
1: a=0 b=0 c=0 d=1 (1)
8: a=1 b=0 c=0 d=0 (0)
12: a=1 b=1 c=0 d=0 (0)
14: a=1 b=1 c=1 d=0 (1)
这篇关于为条件(A&& B&& C)执行MCDC || d的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!