Friday, November 13, 2009

Chapter 33.  Restructuring the System for Testing









Chapter 33. Restructuring the System for Testing


Chapter 30 introduced the motivation for changes to the application to accommodate testability. Chapter 32 showed one way to begin testing without such changes, by testing through the user interface. Such tests can then support the process of changing the application itself, helping to ensure that bugs are not introduced in the process.


In this chapter, we introduce the ways and means of test infecting an application. Surprisingly, the changes we need to make to enable direct testing also have huge benefits in other respects. Michael Feathers [Fea04] provides considerable help in working with legacy, or non-test-infected, code.


Sometimes, quite drastic changes are needed, and this can be off-putting because it looks like wasted work. The way forward is to make small changes that gradually test infect the code in areas that are changing anyway or are of low quality, so that the quality spreads in an organized, nonrisky manner.


To do this, a boot-strapping approach is needed. Once in place, a slow outer layer of tests can support the evolution of changes to the application to test infect it.









    No comments: