I l@ve RuBoard Previous Section Next Section

7.6 Testing

Once the program is compiled without errors, you can move on to the testing phase. Now is the time to start writing a test plan. This document is simply a list of the steps you perform to make sure the program works. It is written for two reasons:

  • If a bug is found, you want to be able to reproduce it.

  • If you ever change the program, you will want to retest it to make sure new code did not break any of the sections of the program that were previously working.

The test plan starts out as something like this:

Try the following operations 

+ 123    Result should be 123 
+ 52     Result should be 175 
x 37     Error message should be output 

Running the program you get the following results:

Result: 0 
Enter operator and number: + 123
Result: 123 
Enter operator and number: + 52
Result: 175 
Enter operator and number: x 37
Result: 212 

Something is clearly wrong. The entry x 37 should have generated an error message but didn't. There is a bug in the program, so you begin the debugging phase. One advantage to making a small working prototype is that you can isolate errors early.

    I l@ve RuBoard Previous Section Next Section