Articles

Design the test cases and test the program of Quadratic Equation problem using Path testing

Share

In this article, we will perform path testing on the quadratic equation program (Here’s the code) in order to generate test cases.

The first step is to create a flow graph using quadratic equation program.

After creating the flow graph, it’s time to make a Decision-to-Decision Graph (DD Graph). List one by one consecutive nodes and assign an alphabet.

Generate a DD graph.

Now, calculate cyclomatic complexity which represent the number of possible paths,

=E − N + 2P

=16-13+2

=5

After calculating cyclomatic complexity, generate independent paths.

– A,B,D,F,H,I,J,L,M
– A,B,D,F,G,I,J,L,M
– A,B,D,E,I,J,L,M
– A,B,C,I,J,L,M
– A,B,C,I,J,K,L,M

The last step is to formulate test cases based on the calculated independent paths.

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

This post was last modified on November 22, 2019

Sandeep Verma

Published by
Sandeep Verma
Tags: path testing software testing software testing lab st ST lab test cases