Data Flow Testing

Learn via video courses
Topics Covered

Overview

Data flow testing is a white box testing technique where the module is tested on the basis that the value of the variable passing is correct. Control flow graphs are used for the same. Flow testing is an excellent approach for integration testing.

What is Data Flow Testing?

Data flow testing is a white box testing type concerned with the flow of variables and not the module's flow. It follows where the variable is referenced. Data flow testing makes use of control flow graphs and associations.

The below example will look at both techniques.

Example

Control Flow Graph of the Above Example

Control flow graphs are used to represent the code graphically. This representation helps depict the code flow of variables to help data flow testing.

Control flow Graph

Transform Your Career

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program

Types of Data Flow Testing

Scaler Placement Report and Statistics

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data

1. Static Data Flow Testing

Declaring the variables, using the variables, and finding the values all happen without the code execution is static data flow testing. Control flow graphs are used for the same.

2. Dynamic Data Flow Testing

The variables and their value are examined with the code execution in dynamic data flow testing. The changes in the variable and their references are observed with the requirement that the code must be executed.

Associations

Here associations are made between, where the variable is defined and used. The format of the association is as follows: (line variable declared, line variable used, variable name).

  1. int(x)

  2. if(x%2==0)

  3. x=x+10

  4. else

  5. x=x+5

Associations of the above code are as follows:

(1,(2,t),x) for the true condition in line 2 (1,(2,f),x) for the false condition in line 2 (1,3,x) for the x being used in line 3 (1,5,x) for the x being used in line 5

There are two types of uses of variables based on how they are being used in the code.

Predicate use: This value decides the flow of the code, as in line 2 is called p-use. Computational use: The variable's value is used by another variable, so if we have z=x in line 6. That would be a c-use.

Turn Learning into Career Growth

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

Advantages of Data Flow Testing

  1. Data flow testing helps to redefine the flow of code.
  2. It helps to identify the excess code if it exists.
  3. It helps to identify computational variables.
  4. It tests the code without executing it.

Disadvantages of Data Flow Testing

  1. Since it is white box testing, coding knowledge is required.
  2. It is a time-consuming testing process.
  3. It requires a good amount of manual testing.
  4. It is a slow process as a lot of manual intervention is required.

Scaler Placement Report and Statistics

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data

Data Flow Testing Coverage

  1. All definition coverage: It covers all the sub-paths from each definition.
  2. All definition-c use coverage: It covers all the computation use sub-paths from each definition
  3. All definition-p use coverage: It covers all the predicate use sub-paths from each definition
  4. All-use coverage: It covers all the c-use and p-use sub-paths from each definition.
  5. All definition use coverage: It covers all the sub-paths from definition to their respective use.

Data Flow Testing Strategies

Test case selection criteria are as follows

  1. All-defs: All the sub-paths that include c-use and p-use. Suppose there is a variable x and node i to select all edges.
  2. All c-uses: There is global node i to all the sub-paths to node j. Select all the sub-paths which are c-use.
  3. All p-uses: There is global node i to all the sub-paths to node j. Select all the sub-paths which directly use variable x.
  4. Some c-uses: From the global declaration of variable x with node i, choose selectively sub-paths node j, which affects the module.
  5. Some p-uses: From the global declaration of variable x with node i. Choose selectively sub-paths node j directly affecting the value of a variable.

Data Flow Testing Applications

  1. Noticing the change and updation of a variable make the module more bug-free than merely doing branch testing.
  2. Debuggers are an excellent tool to track data changes in a variable.
  3. Data flow testing tools are integrable into the compilers helping in unit testing.

Conclusion

  1. Data flow testing is a white box testing type where the module is tested based on changes recorded by the variable.
  2. Data flow testing can be done both statically and dynamically.
  3. Control flow graphs and associations are excellent data flow testing techniques.
  4. Data flow testing tools are now integrated with the compilers directly.

See More

Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more