Skip to content

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 ).

数据流测试是结构测试技术的一种形式,其重点是代码中变量获得价值(被定义)的点和代码中这些变量被引用(被使用)的点。

Use more often in WBT.

1. Data Dependency graphs (DDGs)

e.g. \(z \leftarrow x + y\):

Screenshot 2024-03-23 at 12.09.35

e.g \(d = b^2 - 4ac\) $$ (d > 0) \Rightarrow r \leftarrow 2;\ (d = 0) \Rightarrow r \leftarrow 1; \ (d < 0) \Rightarrow r \leftarrow 0; $$ Screenshot 2024-03-20 at 20.11.43

graph TD;
    I(Inputs) --> X["X Calculation"];
    L("L Value") -.-> D["Decision (L < X < U)"];
    U("U Value") -.-> D;
    X --> D;
    D -->|X is accepted| Y["Output X"];
    D -->|X is rejected| Z["Output -1"];

2. Defining Data Slices

Screenshot 2024-03-22 at 12.39.39

Reference

https://www.cnblogs.com/chen1chen/p/17102890.html

这个博主写非常好, 我看得懂也学到了好多