Make your own free website on Tripod.com

Structural Testing using Basis Path Testing

Basis path testing is a white box testing technique. The basis path method enables the test case designer to derive a logical complexity measure of a procedural design and use this measure as a guide for defining a basis set of execution paths.

FLOW GRAPH NOTATION

There are 6 paths illustrated in the graph above.

 

Test Case 1

In this test case we will test the function of Inserting items into the binary tree. First type "i" to select the function for insertion. The program prompts the user to enter the numbers(nodes) and names. One or more numbers can be entered to insert into the binary tree.

Test data

Input the following
70 a
35 h

Test result

Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>i
Enter key and name
70 a
OK
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>i
Enter key and name
30 h
OK
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>w
Current tree
Name Key
h : 30;
a : 70;
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>q
 

Test Case 2

In this test case we will test the function of Deleting an item from the binary tree. First type in ‘d’ to select the function for deletion. The program prompts the user to enter the number. The number is deleted from the binary tree if found else a not found message should be displayed.

 

Test Data

Input the following
70 a
30 h
Delete 30

Test result

Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>i
Enter key and name
70 a
OK
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>i
Enter key and name
30 h
OK
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>d
Enter key : 30
Removed item: h : 30;
Destroyed
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>w
Current tree
Name Key
a : 70;
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>
 

Test Case 3

In this test case we will test the function of searching an item from the binary tree. First type in ‘s’ to select the function for searching. The program prompts the user to enter the number. The number is selected if found in the binary tree. Otherwise it should display ‘record not found’.

 

Test data

Input the following
a) 70 a
30 h
Search for 70
b) Search for 40

Test Result

a)

Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>i
Enter key and name
70 a
OK
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>i
Enter key and name
30 h
OK
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>s
Enter search key : 70
Found record : a : 70;
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>
 

b)

>s
Enter search key : 40
Not found
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>
 

Test Case 4

In this test case we will test the function of Printing the binary tree. First type in ‘p’ to select the function for printing. The binary tree is printed.

Test data

Input the following
70 a
30 h
75 g
35 l

Test Result

Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>i
Enter key and name
70 a
OK
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>i
Enter key and name
30 h
OK
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>i
Enter key and name
75 g
OK
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>i
Enter key and name
35 l
OK
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>
>p
75
70
35
30
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>
 

Test Case 5

In this test case we will test the function of Sorting the items in the binary tree. First type in ‘w’ to select the function for sorting. The program displays the binary tree items in a sorted order.

Test data

Use the data from the above test case

Test result

>w
Current tree
Right Child Parent (Last is Root)
h : 30;
l : 35;
a : 70;
g : 75;
Q to quit, s to Search, i to Insert, d to Delete, p Print, w Walk
>
 

Test Case 6

In this test case we will test the function of Quit. First type in ‘q’ to select the function for Quiting. The program is terminated.

Test data

Use the data from the above test case

Test Result

>q
Press any key to continue

 

Conlusion for the Test Resutls

The program do not make any error when inserting, deleting, walking( sorting), printing, searchng or printing the binary tree.