White box testing

Above is a diagram of what white box testing looks like. White box or glass box testing is where the structure of the code is being tested. For example we might test to see if an IF statement is run etc. We are looking at the different paths through the code. Every time you have a control statement you effectively create a new path through the code. As such each path must be tested.

This sort of tests tends to be carried out by the developer as they will know more about the code. They will know what sort of values should trigger a certain path through the code.. Consider the following example

There are two possible paths through the code. If A equals one or if A does not equal one. In order to trigger the two paths the programmer would need to run two tests. Clearly this is a simple example. Code tends to have many different paths. In fact a program could have in excess of a billion different possible paths through it. As such testing every path through a system is impossible.

So which paths should we test? This will be looked at in some detail later.