Algorithm Testing

How do you know if your algorithm (program) works?

Well..you test it...Try it out with a variety of test data and see if any problems arise.

One technique is to dry run the program.

This involves writing down a table of the instructions that are executed and noting the values of all the constants and variables as each instruction is executed. 

Okay..so you need a lot of paper...but it is a useful technique if you have a program which does not work properly....and it really is useful when doing Assembly Language programming...but that's another story....

 

 

Selection of Test Data

When testing an algorithm, you need to run a sequence of tests. If one test works, that does not mean the program will work every time!

Select...

  • data which is 'normal'
  • data which is extreme
  • data which is incompatible ie data of the wrong type
  • data which is non-existent ie zero or null data

Example

If you are testing a procedure that calculates the VAT on the price of a purchased item, choose

  • sensible prices eg £12.50
  • very large or very small prices eg £0.01 or £12,000,000,000,000,000.00
  • try giving it a string! eg 'Hello'
  • try £0.00 or even a null input.

 

 
Alpha testing - Testing of software before release to the general public, usually done in the software developer's simulated environment. Minor changes may be made as a result of this testing.

Beta testing - Testing carried out by a limited number of selected potential customers in a real-time situation, asking for feedback and bug reports. This testing is done in the client's environment.

Acceptance testing - is carried out by a client who uses the software for a while before deciding whether to buy it. The client will check that the software meets the requirements specification.