需要多少个测试用例来覆盖以下程序片段的所有可能的语句序列(路径)?
if (condition 1)
then statement 1
else statement 2
fi
if statement 2
then statement 3
fi答案应该是3,但我不知道为什么?有人能画一张图表或者解释一下吗?ISTQB基础水平文件#3第37号。
发布于 2017-06-14 15:29:32
有三条路。如果我使用更多的c#语法来表示它,您将得到以下内容:
if (condition1)
{
statement = statement1;
}
else
{
statement = statement2;
}这给了我们两条路:
condition1 == true -> statement1
condition1 == false -> statement2接下来,检查语句2是否为true/false:
if (statement2)
{
statement = statement3
}所以你的三个终点是:
condition1 true -> statement1 (value doesn't matter)
condition1 false -> statement2 true -> statement3
condition1 false -> statement2 false -> statement2发布于 2018-04-03 15:10:04
我认为对账单的覆盖范围是2。
我们走吧
condition1 = a>b
condition2 = c>d
**test case1:** a=3,b=1,c=5 and d=3在本案中,报表1和报表2包括在内。
**testecase2:** a-1,b=3,c=5 and d=3在本例中,包括报表2和报表3。
也就是说,对于两个测试用例,我们可以覆盖所有语句
因此,语句覆盖率是2。
https://sqa.stackexchange.com/questions/27795
复制相似问题