path testing – Programmerbay https://programmerbay.com A Tech Bay for Tech Savvy Sat, 23 Nov 2019 06:19:57 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://programmerbay.com/wp-content/uploads/2019/09/cropped-without-transparent-32x32.jpg path testing – Programmerbay https://programmerbay.com 32 32 Design the test cases and test the program of Triangle problem by using Path testing https://programmerbay.com/design-the-test-cases-and-test-the-program-of-triangle-problem-by-using-path-testing/ https://programmerbay.com/design-the-test-cases-and-test-the-program-of-triangle-problem-by-using-path-testing/#respond Fri, 22 Nov 2019 19:02:40 +0000 https://programmerbay.com/?p=5473 In this type of testing, test cases are drived by considering all the independent paths of the DD graph.

Here’s is the triangle problem code.

In path testing, first we create the flow graph of the triangle problem based on the program which shows the flow and possible paths.

path testing practical problem 1

Once the flow graph is created, with the help of it list all the consecutive nodes and assign an alphabet to them.path testing practical problem

After creating DD Table, it’s time to generate DD graph through which Cyclomatic complexity and the possible path will be gathered.

path testing practical problem 2

Using DD graph ( Decision to Decision graph ), calculate the cyclomatic complexity which tells all the independent paths.

Cyclomatic complexity = E – N + 2P

= 20-16+2

=6

Possbile paths are:

-A,B,C,D,E,F,G,K,L,M,O,P
-A,B,C,D,E,F,H,I,K,L,M,O,P
-A,B,C,D,E,F,H,J,K,L,M,O,P
-A,B,C,D,K,L,M,O,P
-A,B,C,D,K,L,M,N,O,P
-A,B,K,L,M,O,P

Based on these paths, we will create Test cases.

Test IDabcExpected OutputProgram OutputTested Outcome
15105Not a triangleInvalid InputFail
21095Scalene triangleScalene trianglePass
3515Isosceles triangleIsosceles trianglePass
4555Equilateral TriangleEquilateral TrianglePass
5-155Invalid InputInvalid InputPass
65511Invalid InputInvalid InputPass

]]>
https://programmerbay.com/design-the-test-cases-and-test-the-program-of-triangle-problem-by-using-path-testing/feed/ 0
Design the test cases and test the program of Quadratic Equation problem using Path testing https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-problem-using-path-testing/ https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-problem-using-path-testing/#respond Fri, 22 Nov 2019 10:59:03 +0000 https://programmerbay.com/?p=5453 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.

path testing data flow graph

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.

Path testing

Generate a DD graph.

path testing 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

]]>
https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-problem-using-path-testing/feed/ 0