A computer program is often developed by more than one programmer. A complex problem can be decomposed into a series of smaller problems.
As such, it is usually modularised, allowing different programmers to implement a different part of the program easily.
Modules will either be functions or procedures.
As an example, let's have a look at the following structure chart, a common way to represent an algorithm:
If you run the program you will notice that the functions to convert the height into inches and meters always return the same value.
This is becuase these functions have not been written yet.
However, to test other parts of the system, these functions should return something. So, dummy modules have been created. These are often called test stubs and will be fully implemented later on in the project lifecycle.
When modules are fully designed they need to be tested, often independently of the whole system. They would undergo black box or white box testing.
When a module is ready to be integrated into the whole system, it would undergo integration testing.
Ultimately, there will be no stubs left; all of the modules will be fully designed, tested and integrated.
We test a system by inputting data and comparing the result with the expected result.
For example, if we are testing a keyboard, when we press a key we expect to see the same letter or symbol on the screen.
We don't care how the system works. We are just testing that it works as expected. Test data is selected to make sure the system does what it is supposed to do and can handle different kinds of test data (see below).
This is black-box testing and is often used during beta testing with some end users or acceptance testing after the full system has been implemented/installed.
If we are testing code eg a subroutine or even a whole program, we need to make sure that every path through the code is tested.
This means that test data needs to be carefully selected.
This kind of testing is known as white-box testing and is most often used during the alpha testing stage of the software development lifecycle.
The following are 3 kinds of test data used to test a system:
When the program has been fully developed, the development team will design an alpha testing program to formally make sure the system works as intended.
Then, a small group of end users will use the system to iron out any final kinks in the system - this is known as beta testing.
The system will finally undergo acceptance testing at which time it will be fully installed on the users' system.