Black Box Testing using
Equivalence Partitioning
The black box testing are concerned with selecting test
cases to exercise the software in a thorough and systematic way,
where a test case consists of a sample input value, the expected
result ( what the software should do), an d the actual result (
what the software did do), together with any other necessary
information ( procedure for executing the test, environment
needed, etc)
Equivalence Partitioning
The idea behind equivalence partitioning is that testing is
more effective if the tests are distributed over all the
different possibilities rather than all testing the same thing.
In this program, we need to test 4 functions:
- Insert Insert an integer to the binary tree
- Search search for an integer in the binary tree
- Delete delete an integer in from the binary tree
- Print - print out the current binary tree
- Walk (Sort) walk through the binary tree and print
out the sorted numbers with their name
Test case 1
Test case with integer numbers
Test data ( the key and name for the node)
- 45 j
- 30 b
- 20 p
- 15 k
Test Result
To insert the test data into the binary tree
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- 45 j
- OK
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- 30 b
- OK
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- 20 p
- OK
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- 15 k
- OK
In order to print the binary tree
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >p
- 45
- 30
- 20
- 15
To delete an integer from the binary tree
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >d
- Enter key : 20
- Removed item: p : 20;
- Destroyed
To print the result again after deletion
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >p
- 45
- 30
- 15
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
-
To search for an integer in the binary tree
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >s
- Enter search key : 30
- Found record : b : 30;
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >s
- Enter search key : 60
- Not found
To sort the binary tree
- >w
- Current tree
- Name Key
- k : 15;
- b : 30;
- j : 45;
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- > q
-
Test case 2
Test case with negative numbers
Test data ( the key and name for the node)
- -45 j
- -30 b
- -20 p
- -15 k
-
- Test Result
To insert the test data
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- -45 j
- OK
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- -30 b
- OK
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- -20 p
- OK
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- Enter key and name
- -15 k
- OK
To print to out the binary tree
- Q to quit, s to Search, i to Insert, d to Delete, p
Print, w Walk
- >p
- -15
- -20
- -30
- -45
To delete an integer from the binary tree
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >d
- Enter key : -20
- Removed item: p : -20;
- Destroyed
To print the binary tree after deletion
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >p
- -15
- -30
- -45
To search for an integer in the binary tree
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >s
- Enter search key : -30
- Found record : b : -30;
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >s
- Enter search key : -60
- Not found
To sort( walk through) the binary tree
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >w
- Current tree
- Name Key
- j : -45;
- b : -30;
- k : -15;
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- > q
-
Test case 3
Test case with 0
Test data ( the key and name for the node)
- 45 j
- 30 b
- 20 p
- 15 k
- 0 i
Test Result
To insert integers into the binary tree
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- 45 j
- OK
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- 30 b
- OK
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- 20 p
- OK
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- 15 k
- OK
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- 0 i
- OK
To print out the binary tree
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >p
- 45
- 30
- 20
- 15
- 0
To delete an integer into the binary tree
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >d
- Enter key : 45
- Removed item: j : 45;
- Destroyed
To print the binary after deletion
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >p
- 30
- 20
- 15
- 0
To search for an integer in the binary tree
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >s
- Enter search key : 45
- Not found
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >s
- Enter search key : 0
- Found record : i : 0;
-
To sort( walk through) the binary tree
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >w
- Current tree
- Name Key
- i : 0;
- k : 15;
- p : 20;
- b : 30;
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- > q
-
Test case 4
- Test case with repeating numbers
Black box test data ( the key and name for
the node)
- 45 j,
- 30 b
- 20 p
- 15 k
- 45 j
Test Result
To insert integers into the binary tree
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- 45 j
- OK
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- 30 b
- OK
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- 20 p
- OK
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- 15 k
- OK
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >i
- Enter key and name
- 45 j
- Sorry, duplicate keys not allowed
- Problems
- Q to quit, s to Search, i to Insert, d to
Delete, p Print, w Walk
- >q
Conclusion for the test results
This program accepts integer numbers, negative
numbers and zeros. However, this program does not take repeating
numbers as it prompt out an error message saying," Sorry,
duplicate keys not allowed".