分支测试 [英] Branch testing

查看:43
本文介绍了分支测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

if(condition1)
    dosomething1();
if(condition2)
    dosomething2();
if(condition3)
    dosomething3();

如果我在这个例子中有两个测试用例,是否是完整的分支测试

Is it full branch testing if I have two test cases in this example

  1. 条件 1 = 条件 2 = 条件 3 = 真;
  2. 条件 1 = 条件 2 = 条件 3 = 假;

还是我误会了?试图找出分支测试和路径测试之间的区别.我进行了路径测试,所以希望这是正确的.

Or have I misunderstood it? Trying to figure out the difference between branch and path testing. I get path testing so hope this is correct.

推荐答案

分支测试:

至少测试一次程序源代码中的所有分支的测试.

Testing in which all branches in the program source code are tested at least once.

是的;您正在执行正确的分支测试,因为您的所有分支都被命中.事实上,您可以删除第二个测试用例,因为用例 1 执行所有分支.

Yes; you are performing correct branch testing, since all your branches are hit. In fact you can remove your second test case, since case 1 executes all the branches.

显然分支测试没有路径测试那么全面,因为它被依赖的可能性很低,因此,不应该是你唯一的测试形式.

Obviously branch testing is less encompassing than path testing, since it's likelyhood of hitting dependies is low and as such, ought not to be your only form of testing.

这篇关于分支测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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