Testing
Why test a program?
We need to test to check that a program meets the user requirements and works as intended. User requirements are normally planned out before a program is written.
For example a quiz program might list:
- The user must be able to enter their name.
- The quiz questions must appear in the correct order.
- If the user answers a question correctly a point must be added to their score.
- The final score must be displayed at the end of the quiz.
We need to also make sure that the program does not crash and that if there is an error a suitable error message is displayed. If a test fails, it gives us a chance to perform remedial action to correct the error and test again.
Types of Testing
- Iterative - as you go along. If you spot a bug, fix it and then test again.
- Final - at the end! Once the author testing is complete, beta testing is usually carried out with a beta customer.
Test Data
Planning how to test is crucial. If we select the right data we will find more errors.
- Normal - data that should be acceptable e.g. a test score of 23% .
- Erroneous - data that is definitely not acceptable e.g. a test score of 200%.
- Boundary - This is data that is right on the edge of the acceptable values. It can be valid e.g. 0 or 100% or invalid data (just outside the acceptable range) e.g. -1% or 101%.