繁体   English   中英

路径测试和分支测试

[英]path testing and branch testing

你能解释一下Path和Branch测试之间的区别吗?

我读过许多文章,但我仍然对这两者感到困惑。

我在堆栈溢出搜索但我没有找到任何合适的答案请通过提供链接帮助我,如果我复制这个问题。

谢谢,

快速摘要

摘自https://www.cs.drexel.edu/~jhk39/teaching/cs576su06/L4.pdf

路径测试:

  • 100%路径覆盖率。
  • 通过程序执行所有可能的控制流路径。

声明测试:

  • 100%的声明覆盖率。
  • 在一些测试中至少执行一次程序中的所有语句。

分支测试:

  • 100%分支机构覆盖率。
  • 执行足够的测试以确保在某些测试下每个分支替代方案至少已被执行一次。

通常路径测试> =分支测试> =语句测试,就他们在系统正确性方面可以提供多少信心而言。

讨论

路径覆盖率通过执行的程序计算从输入到输出的完整路径的数量,而分支覆盖率计算在任何时间点测试的分支的数量。 在此定义中,完整路径覆盖将导致完整的分支覆盖。

可能存在多个路径命中单个条件语句,并且完整路径覆盖可以测试不同的变体(因为在if语句内部可以调用外部资源,哪个分支覆盖不会识别)。 分支覆盖更像是测试分支在某个时刻被命中,并且参数被正确地传递给模拟外部资源(不一定是后来的)。

如下所示: https//www.cs.drexel.edu/~jhk39/teaching/cs576su06/L4.pdf ,我们有时可以通过流程图表示所有路径的集合,目标是验证从开始的每个路径结束在路径测试中按预期工作。

分支测试附加说明

从这里: 分支测试

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

路径测试附加说明

从这里: http//www.qualitytesting.info/forum/topics/what-is-difference-between-2http://www.cs.st-andrews.ac.uk/~ifs/Books/SE9/网络/测试/ PathTest.html

A path is a sequence of executable statements. Testers are concerned with
"entry-exit paths", which begin at the entry point into a given process and
proceed to its exit point. 

The objective of path testing is to ensure that each independent path through
the program is executed at least once. An independent program path is one that
traverses at least one new edge in the flow graph. In program terms, this means
exercising one or more new conditions. Both the true and false branches of all
conditions must be executed.

基础路径测试,结构化测试或白盒测试技术,用于设计测试用例,旨在至少检查一次所有可能的执行路径。 为所有可能的路径创建和执行测试会产生100%的语句覆盖率和100%的分支覆盖率。

分支覆盖是一种测试方法,旨在确保每个决策点的每个可能分支至少执行一次,从而确保执行所有可到达的代码。

也就是说,每一个分支都采用各种方式,无论是真是假。 它有助于验证代码中的所有分支,确保没有分支导致应用程序的异常行为。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM