基本与复合条件险 [英] Basic vs. compound condition coverage

查看:117
本文介绍了基本与复合条件险的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力弄清这两个覆盖标准之间的差异,我无法弄清它们之间的差异.我认为我无法确切了解什么是决策范围.我的软件测试教科书指出,复合决策覆盖范围可能很昂贵(n个基本条件的2 n 个组合).

I'm trying to get my head around the differences between these 2 coverage criteria and I can't work out how they differ. I think I'm failing to understand exactly what decision coverage is. My software testing textbook states that compound decision coverage can be costly (2n combinations for n basic conditions).

我原本以为基本情况的覆盖范围会更昂贵.

I would have thought basic condition coverage would be costlier.

考虑a && b && c && d && e.我的理解是,在基本条件覆盖范围内,每个原子变量在一个测试用例中必须具有值TRUE和FALSE,才能使测试用例具有基本条件充分性-这是32个不同的测试用例.

Consider a && b && c && d && e. My understanding is that in basic condition coverage, each of these atomic variables have to have the value TRUE and FALSE in a test case for the test case to be have basic condition adequacy - that's 32 different test cases.

那么实际的差异是什么,被称为基本条件".在上面的示例中,a是基本条件吗?

So what is the actual difference, and what is referred to as a "basic condition". In the example above, is a a basic condition?

谢谢.

推荐答案

关于术语,我没有一个方便的来源使用确切的术语基本条件覆盖范围"和多个条件覆盖范围".活页夹的测试面向对象的系统"说条件覆盖率"和多条件覆盖率".埃弗里特& McLeod的软件测试"说简单条件覆盖"和复合条件覆盖".但是我敢肯定,每种情况下的第一个术语是您的基本疾病覆盖率",第二个术语是您的复合疾病覆盖率".我将在下面使用这些术语.

Regarding terminology, I don't have a single source handy that uses the exact terms "basic condition coverage" and "multiple condition coverage". Binder's "Testing Object-Oriented Systems" says "condition coverage" and "multiple-condition coverage". Everett & McLeod's "Software Testing" says "simple condition coverage" and "compound condition coverage". But I'm certain that the first term in each case is your "basic condition coverage" and the second is your "compound condition coverage". I'll use those terms below.

基本条件覆盖范围是指程序中的每个基本条件在某些测试中为true,在某些测试中为false,而与其他条件无关.在下面

Basic condition coverage means that every basic condition in the program is true in some test and false in some test, regardless of other conditions. In the following

if a && b && c
  # do stuff
else
  # do other stuff
end

有一个复合条件a && b && c,具有三个基本条件abc.仅需两个测试用例即可获得完整的基本条件覆盖,其中一个所有基本条件都为真,另一个都为假.基本条件恰好是复合条件的一部分也没关系.

there is a compound condition, a && b && c, with three basic conditions, a, b and c. It takes only two test cases, one where all basic conditions are true and one where all are false, to get full basic condition coverage. It doesn't matter that the basic conditions happen to be part of a compound condition.

请注意,基本条件范围不是分支范围.如果复合条件为a && b && !c,则上述两个测试用例仍将达到基本条件覆盖范围,但不会达到分支覆盖范围.

Note that basic condition coverage is not branch coverage. If the compound condition were a && b && !c, those two test cases above would still achieve basic condition coverage but would not achieve branch coverage.

针对基本条件覆盖的一套不太积极地优化的测试用例将有一个测试用例,其中所有三个基本条件均为假,而三个测试用例中的每个基本条件都不相同.在复合条件下,这仍然仅仅是基本条件的八种可能组合中的四种.我们忽略其他四个的令人不安的感觉就是为什么复合条件覆盖.这需要对复合条件下基本条件的每种可能组合进行测试.在上面的示例中,您需要进行八项测试,以对abc的可能值的每种可能组合进行一次测试,以获得完整的复合条件覆盖范围.

A less aggressively optimized set of test cases for basic condition coverage would have one test case where all three basic conditions are false and three test cases with a different basic condition true in each. That would still only be four of the eight possible combinations of basic conditions in the compound condition. The uncomfortable feeling that we're ignoring the other four is why there's compound condition coverage. That requires a test for each possible combination of basic conditions in a compound condition. In the example above, you'd need eight tests, one for each possible combination of possible values of a, b and c, to get full compound condition coverage.

这篇关于基本与复合条件险的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆