Design the test cases and test the program of Quadratic Equation by using Data Flow testing

Data flow testing doesn’t deal with the flow of the program, instead, it tracks which variable is used when. It means that it simply checks the initialization and usability of variables.

In this, we will drive test cases using Data flow testing approach by considering the Quadratic equation example. The first step is to create a flow graph from the code of the Quadratic Equation.

path testing data flow graph

Using the flow graph, create a Decision to Decision Graph ( DD Graph) by converting each set of consecutive nodes into a single node.

Path testing

Replace these numbers with correspondent DD nodes.

path testing DD graph

Create a Defined and Used node table to get a clear view of variable usage.

DU or DC for Quadratic equation

On the basis of the above table, we will generate du and dc path respectively.

DU or DC for Quadratic equation 2

All the ‘Y’ in the above table are DC path and ‘Path nodes’ are DU paths.

Now, create the test cases from input provided by the user in such a way that all the paths get covered.

Test IDabcExpected OutputProgram OutputTested Outcome
1055Not QuadraticNot QuadraticPass
2155RealRealPass
3955ImaginaryImaginaryPass
45105EqualEqualPass
5-155Invalid InputInvalid InputPass

Leave a Reply