Anyone who has ever seen a piece of code accidentally released into a production environment will appreciate the value of a strong testing regime. Obviously if the code is 100% correct and contains no errors then the effect will be negligible, however that rarely happens. Untested code can create huge problems and create very expensive problems which can be difficult to rectify. Even the smallest change which looks fairly trivial in development can have far reaching effects when released into a live environment. It doesn’t matter where you are or what technology is involved – testing will always be a worthwhile exercise.

Any component needs testing even if it appears unnecessary in fact sometimes then it’s even more important. I once saw a huge network brought to it’s knees when a small but important update to Microsoft ISA server was released without testing. It seemed trivial but of course, firewalls and proxies can impact lots of other systems besides themselves. This was in a software creation company but the chaos would have been much greater with a larger number of proxies, perhaps somewhere like a residential IP provider with large proxy infrastructure.

We need to understand a little more about how software testing works in practice before we can think about how to implement effective testing. Testing and debugging are different kinds of activity, both of which are actually extremely important. Debugging is the process that developers undergo to determine the reason for bugs or defects in code as well as undertake corrections. Ideally some check of the correction is made, however this may not extend to checking that other areas of the system have not been inadvertently affected by the correction. Testing, meanwhile, is a systematic exploration of a factor or system with the major objective of finding and documenting defects.

Testing does not incorporate correction of problems– these are passed on to the web developer to correct. Testing does, however, guarantee that changes and corrections are examined for their impact on other parts of the component or system. Effective debugging is essential before testing starts in order to raise the level of quality of the component or system to a level that is worth testing, i.e. a level that is sufficiently robust to make it possible for rigorous testing to be performed. Debugging does not provide confidence that the element or system meets its criteria totally. Testing makes a rigorous examination of the behaviour of a component or system and reports all flaws found for the development team to fix. Testing then repeats sufficient tests to ensure that defect corrections have been successful. So both are needed to achieve a quality result. Static testing and dynamic testing Static testing is the term used for testing where the code is not exercised. This might sound strange, but remember that failures often start with a human mistake, specifically a mistake in a document such as a specification. We need to test these due to the fact that mistakes are significantly cheaper to fix than problems or failures (as you will see). That is why testing should start as early as possible, another fundamental principle explained in more detail later in this chapter. Static testing consists of strategies such as reviews, which can be effective in preventing defects, e.g. by eliminating ambiguities and errors from specification documents; this is a topic in its own right and is covered in detail later in this blog.

Dynamic testing is the type that exercises the program under test with some test data, so we mention test execution in this context. The discipline of software testing encompasses both static and dynamic testing. Testing as a process We have already observed that there is a lot more to testing than test execution. Before test execution there is some preliminary work to do in order to design the tests and set them up; soon after test execution there is some work needed to record the end results and check whether the tests are complete. Even more essential than this is deciding what we are definitely trying to achieve with the testing and setting clear objectives for each test.

A test developed in order to provide confidence that a program functions according to its specification, for example, will definitely be really quite different from one developed to find as many different defects as achievable. We define a test method to guarantee that we do not miss out on crucial steps and also we do things in the appropriate order. We will return to this important subject later, where we explain the key test process in detail. Testing as a set of techniques The final challenge is to make sure that the testing we do is reliable testing. It may seem peculiar, but a good test is one that finds a problem if there is one present. A test that finds no defect has consumed useful resources however added no value; a test that finds a flaw has created an option to improve the quality of the product. Just how do we design tests which find defects? We actually undertake two things in order to maximize the effectiveness of the tests. We use well-proven test design techniques, and a selection of the most important of these is explained in detail in Chapter 4. The techniques are all based upon specific testing concepts that have been identified and documented over the years, and these types of principles are the second mechanism we use to ensure that tests are effective.

Further Reading: