The main purpose of creating algorithms is to explain the logic of the solution. Therefore checking algorithms is primarily about checking the correctness of the logic. Checking doesn’t just take place once an algorithm has been completed, rather it is an ongoing process occurring during the algorithm’s development. The primary technique for checking algorithms is known as desk checking. As the name implies, a desk check is the process of working through an algorithm using pencil and paper. Test data where the expected outputs are known, provide the inputs for the desk check. In "Section 8.2.3 Testing" we examine the creation of test data and desk checking in detail. To be sure an algorithm performs correctly for all expected inputs requires that all paths through the algorithm be tested. Test data should be designed to accomplish this aim. This can often be a laborious task when there are many selection statements and loops. For example, an algorithm with 4 binary selections will have a total of 16 unique possible paths requiring up to 16 sets of test data and 16 desk checks. Many algorithms have far more unique paths than this. Iterations can also greatly increase the time required to desk check an algorithm. Most errors occur either as an iteration commences or as it terminates; be careful as loops start and end. Another common source of logic errors is within decisions themselves. The use of incorrect logical operators being the most common e.g. using > instead of ≥. Be sure to test these boundary conditions carefully by including test data boundary value. |
11 SDD > 8.2 Introduction to Software Development > 8.2.3 Testing and Evaluating Solutions > 1. Testing the Solution >
