Test data

Before performing a test, you need to decide what data you are going to include in your test case. It is not normally possible to perform tests with every single possible piece of data. So, instead the developers will choose from a limited range of data such as:

  • valid - the most obvious or common data that should work
  • valid extreme - unusual, extreme or unexpected data, eg the highest and lowest (data that tests the limits but that should work)
  • invalid - data that should definitely fail
  • invalid extreme - data that is at the edge of failure and is nearly acceptable
  • erroneous - data that is the wrong data type

Tests should find that the program works as expected. Obvious input data should confirm that the software works as expected. Extreme test data will be chosen to test what breaks the system.

For example, if you were developing a number-guessing game, you might have a unit of code that asks the user to choose a number in a specific range, eg "Choose a number between 1 and 10". To test this unit, you could try a whole range of inputs to see what happens:

3, 4.5, three, -99, 10.00001


Sometimes software developers use something called an invariant when they are testing or fixing bugs. An invariant is a value or condition that can be relied upon to be true when a program is being executed.

Using something that can be relied upon helps the developer to isolate the units that are working from the units that are not.