Articles

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

Share

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.

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

Replace these numbers with correspondent DD nodes.

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

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

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

Sandeep Verma

Published by
Sandeep Verma
Tags: data flow testing quadratic equation software testing software testing lab st ST lab test cases