0
9.0kviews
Explain static data flow Testing with example.

Mumbai University > Information Technology > Sem 8 > Software Testing and Quality Assurance

Marks: 10 Marks

Year: May 2016

1 Answer
0
140views
  1. A programmer can perform a number of tests on data values, which are collectively known as data flow testing.

  2. Data flow testing can be performed at two conceptual levels: static data flow testing and dynamic data flow testing.

  3. Static data flow testing is performed by analyzing the source code, and it does not involve actual execution of source code.

  4. Static data flow testing is performed to reveal potential defects in programs.

  5. The potential program defects are commonly known as data flow anomaly. An anomaly is a deviant or abnormal way of doing something.

  6. For example, it is an abnormal situation to successively assign two values to a variable without using the first value. Similarly, it is abnormal to use a value of a variable before assigning a value to the variable.

  7. Another abnormal situation is to generate a data value and never use it.

  8. There are three types of abnormal situations with using variable in static data flow testing analysis.

  • Type 1: Defined and then defined again

i.) Example 1: The second definition of x overrides the first.

x = f1(y);

x = f2(z);

ii.) Four interpretations of Example 1

• The first statement is redundant.

• The first statement has a fault -- the intended one might be: w = f1(y).

• The second statement has a fault – the intended one might be: v = f2(z).

• There is a missing statement in between the two: v = f3(x).

iii.) It is for the programmer to make the desired interpretation.

  • Type 2: Undefined but referenced

i.) Example: x = x – y – w; /* w has not been defined by the programmer. */

ii.)Two interpretations

• The programmer made a mistake in using w.

• The programmer wants to use the compiler assigned value of w.

  • Type 3: Defined but not referenced

i.) Example: Consider x = f(x, y). If x is not used subsequently, we have a Type 3 anomaly.

9.) The concept of a state-transition diagram is used to model a program variable to identify data flow anomaly. Components of the state-transition diagrams.

– The states

• U: Undefined

• D: Defined but not referenced

• R: Defined and referenced

• A: Abnormal

– The actions

• d: define the variable

• r: reference (or, read) the variable

• u: undefine the variable

State transition diagram of a program variable

10.) Static data flow Testing Deficiencies are as follows:

– Dead Variables: Detecting unreachable variables is unsolvable in the general case.

– Arrays: Dynamically allocated arrays contain garbage unless they are initialized explicitly. (-u anomalies are possible)

– Pointers: Impossible to verify pointer values at compile time.

– False Anomalies: Even an obvious bug (e.g., ku) may not be a bug if the path along which the anomaly exists is unachievable. (Determining whether a path is or is not achievable is unsolvable.)

Please log in to add an answer.