1.3 Testing Algorithms and Coded Solutions using Test Data

Once a thorough series of test data has been created it needs to be used to check the correctness of the algorithm or code. 

  • Each test data set is used as the inputs into the code. 
  • The results from the tests are then compared to the expected results. 
  • Any inconsistencies arising indicate errors that require further investigation. 
  • In many cases, errors are highlighted during the testing process. 
  • These errors can be corrected immediately and the full set of tests recommenced. 
  • For large projects where testing is undertaken by specialists, a test report would be returned to the developers who in turn make the corrections. 
  • This process cycle continues until the test results confirm the code’s correctness.

If we are checking an algorithm then a manual desk check is performed. 

For coded solutions, most programming environments allow developers to step through each line of code as it is executed. This is essentially an automated desk check. Let us consider each of these techniques.