-
Data Flow Testing 数据流测试
Data flow testing is a form of structural testing techniques that focuses on the points in code where variables obtain valus ( sre defined ) and the points in code where these variables are reference ( are used ). 数据流测试是结构测试技术的一种形式,其重点是代码中变量获得价值(被定义)的点和代码中这些变量被引用(被使用)的点。
-
Data Flow Coverage for Source
DEF: a location where a value is stored into memory Eg:(x =44) x appears on the left side of an assignment; 一个存储数值的位置 Eg:(x =44) x出现在一个赋值的左边。
USE: a location where varia ble's value is accessed Eg:x appears on the right side of an assignment 一个访问变量值的位置 Eg:x出现在赋值的右边
-
Defining Node vs. Usage Node 定义结点与使用结点
DEF (v,n): v is variable name ; n is the node // Node n in the CFG of program P is a defining node 程序P的CFG中的节点n是一个定义节点
USE (v,n): v is variable name ; n is the node // Node n in the CFG of program P is a usage node 程序P的CFG中的节点n是一个使用节点 USE(v,3): v在3处被使用
-
Definition-Use Path vs. Definition-Clear Path 定义-使用路径 vs. 定义-清除路径
DU-Path(a definition-use path): for some variable v there are DEF(v,m) and USE(v,n) such that m, and n are the initial and final nodes in the path respectively.
DU-Path(定义-使用路径):对于某个变量v,有DEF(v,m)和USE(v,n),使得m和n分别是路径中的初始和最终节点。
DC-Path(a definition-clear path):with initial node DEF(v,m) and final node USE(v,n) such that no other node in the path is a defining node for variable v.
DC-Path(一个定义清晰的路径):有初始节点DEF(v,m)和最终节点USE(v,n),这样路径中没有其他节点是变量v的定义节点。 注:不存在其他定义节点
A usage node USE(v,n) is a predicate use, denoted as P-USE Always in nodes with outdegree >=2
A usage node USE(v,n) is a computation use, denoted as P-USE Always in nodes with outdegree <=1
-
Example:
-
All-Defs Coverage Criterion: Every defining node of variable v to some use of v. All-Defs覆盖标准:每个定义节点到一个使用节点的DC路径
-
All-P-Uses Coverage Criterion: Every defining node to every P-Use node. All-P-Uses覆盖标准:每个定义节点到每个使用节点的DC路径
-
All-P-Uses / Some C-Uses Coverage Criterion
- every defining node to every p-use node, and if a definition of v has no p-uses, a definition-clear path leads to at least one c-use
每一个定义节点到每一个p-use节点,如果v的定义没有p-use,那么一个DC路径至少会有一个c-use节点
即 若没有p-use节点则用(某一个)c-use节点替换
-
All-C-Uses / Some P-Uses Coverage Criterion
-
every defining node to every c-use node, and if a definition of v has no c-uses, a definition-clear path leads to at least one c-use
每一个定义节点到每一个c-use节点,如果v的定义没有c-use,那么一个DC路径至少会有一个p-use节点
即 若没有c-use节点则用(某一个)p-use节点替换
-
All-Uses Coverage Criterion
- Every defining node to every uses node 每个定义节点到每个使用节点的定义节点
- add one successor nodes of the use node 添加使用节点的一个后继节点
-
All-DU-Paths Coverage Criterion
- Every defining node to every uses node 每个定义节点到每个使用节点的定义节点
- to all successor nodes of the use node 到使用节点的全部后继节点
- is a DC-Path 是一条DC路径
-
Practice:
- question1
-
Slice and the notion of slicing criterion 分片和分片标准的概念
- A slice s is a partial program which includes all program statements affecting ( a set of ) variables v at position n in program p.
一个分片s是一个局部程序,它包括影响程序p中位置n的(一组)变量v的所有程序语句。
- A slice s is based on a slicing criterion s(v,n) in p; 一个分片s是基于p中的一个分片准则s(v,n)。
-
Example:
Example 1 Example 2
Example 3 Example 4
标签:node,use,定义,Testing,Flow,USE,defining,节点,软件测试 From: https://www.cnblogs.com/chen1chen/p/17102890.html