software testing lab – Programmerbay https://programmerbay.com A Tech Bay for Tech Savvy Sat, 23 Nov 2019 10:15:05 +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 software testing lab – Programmerbay https://programmerbay.com 32 32 Design the test cases and test the program of Triangle Problem by using Data Flow testing https://programmerbay.com/design-the-test-cases-and-test-the-program-of-triangle-problem-by-using-data-flow-testing/ https://programmerbay.com/design-the-test-cases-and-test-the-program-of-triangle-problem-by-using-data-flow-testing/#respond Sat, 23 Nov 2019 10:15:05 +0000 https://programmerbay.com/?p=5505 In this article, we will formulate test cases for triangle problems using data flow testing in such a way that all the du and dc paths get covered. The first step is to generate flow graph from the code ( Here’s the code).

Same as path testing make flow graph.

path testing practical problem 1

Now, make Decision-to-Decision table in which consecutive nodes are counted as an individual.

path testing practical problem

On the basis of above table, create DD graph.

path testing practical problem 2

After DD graph, it is time to figure out du and dc paths. For this, create ‘ defined node and used at node’ table to view variable’s definition and initialization.

data flow testing triangle problem

From above table, find du and dc paths.

data flow testing triangle problem 1

Based on du and dc paths create test cases, covering each and every variable definition and usage.

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

]]>
https://programmerbay.com/design-the-test-cases-and-test-the-program-of-triangle-problem-by-using-data-flow-testing/feed/ 0
Design the test cases and test the program of Quadratic Equation by using Data Flow testing https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-by-using-data-flow-testing/ https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-by-using-data-flow-testing/#respond Sat, 23 Nov 2019 08:05:42 +0000 https://programmerbay.com/?p=5492 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

]]>
https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-by-using-data-flow-testing/feed/ 0
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