Creating Test Data

 
When you write programs it is imperative that you thoroughly test them. You must use test data that tests all possible paths in your program. To create test data you look at the business rules of the scenario and determine pivotal values. Pivotal values are values that change the way the program is suppose to behave. For example for the following business rules

 

If taxable income is greater than $30,000 then taxes are $4,500 plus 28% of the taxable income over $30,000. If taxable income is less than or equal to $30,000 taxes are 15% of taxable income.

 
The pivotal value is 30,000

To adequately test the logic created for this program we needed to use a taxable income

 
We must then determine the output we expect the program to produce for each test value chosen, run the program using the test data and the check to see if it generates the expected output

 

 
If the program works for all the test data chosen we can be fairly confident it will work for all other values as well. (Assuming you will not use invalid input or numbers that are not appropriate for the data types used in the program).

Another Example

 
For the following business rules

If the amount to be withdrawn from an ATM is less than or equal to the existing balance, subtract the amount from the balance to compute and report the new balance. Otherwise, display a message “Insufficient Funds”.

 
For this scenario the pivotal values will not be specific numbers but a relationship between two numbers - the withdrawal amount and the existing balance. We must use numbers where

 

Withdrawal Balance  Output
500 600 100
250 250  0
100 75   Insufficient Funds