2. Test Data for Checking Algorithms and Code


Test data is made up of sets of inputs

  • Each test data set is input into either the algorithm or the coded solution and the processing and outputs are observed. Remember in this chapter we are concerned with checking algorithms and code rather than system-level issues. 
  • Therefore the creation of test data sets, aims to ensure that all processes are thoroughly checked and verified. 
  • To do this efficiently requires an intimate knowledge of the underlying logic within the algorithm or code. 
  • The test data should be thorough but it should also be efficient. 
  • There is little point including multiple test data sets that check identical scenarios. 
  • Similarly, it is more efficient to choose test data where the expected outputs are available or can be readily calculated.

As we are interested in checking the logic of algorithms and source code, each set of test data will be designed to check some particular processing scenario. To do this effectively requires that we know the expected outputs for each test data set. Also there should be a reason for the inclusion of each test data set; each set should have a purpose. The results of our tests can then be compared with the expected results. Inconsistencies between the actual and expected outputs highlighting errors for further examination. As the purpose of the test data causing the error is known then identifying the source of the error is simplified