next up previous contents
Next: 4.3 Glass Box Testing Up: 4 Unit Testing Previous: 4.1 General Strategy   Contents

Subsections


4.2 Black Box Testing

Black Box testing is the process of testing a unit against its expected behavior. That is, particular inputs should produce particular outputs. These tests are to be based on the interfaces given in the SADD. The test cases for Black Box testing are chosen by Equivalence Partitioning, Boundary Value Analysis and Random Selection [1].


4.2.1 Equivalence Partitioning

Equivalence Partitioning is based on the idea that members of a certain input domain are equivalent as far as testing goes. The input domain is first divided into partitions and then test cases are chosen to incorporate inputs from each partition. For each partition, only one valid input value is used, as it is deemed equivalent to other valid inputs in that partition. In addition to this valid input, invalid inputs are also tested.

The use of Equivalence Partitioning reduces the number of test cases required to cover the domain and therefore reduces the number of test cases needed to be written in total.

Example: For the input domain of [1,2,3,4,5,6,7], testing with the valid value 4 and the invalid values of -5 and 10 would be sufficient for Equivalence Partitioning.


4.2.2 Boundary Value Analysis

Boundary Value Analysis is to be used where an input domain is specified. Test cases will be created to test the boundary of the domain. Both boundary values are tested, as well as values directly above and below these.

The purpose of Boundary Value Analysis is to test for off-by-one or fencepost errors where the whole domain may not be covered.

Example: For the input domain of [1,2,3,4,5,6,7], it would be necessary to test with the values 0,1,2,6,7 and 8 to satisfy Boundary Value Analysis.


4.2.3 Random Selection

Where Black Box testing and Boundary Value Analysis may not be appropriate, Random Selection of data will be used. While Random Selection of data is not designed to test portions of code especially prone to bugs, it is useful for testing multiple and large amounts of test data and for generating lots of test cases.


next up previous contents
Next: 4.3 Glass Box Testing Up: 4 Unit Testing Previous: 4.1 General Strategy   Contents