Chapter 1: Introduction


Overview

Testing is important. All software developers know it, but (hardly) anyone does it. [1] Luckily, you have bought this book and therefore don't belong to this ignorant crowd ;-)

There are many reasons for the poor interest of programmers in the quality of their own products. Education plays an important role. Academically educated computer scientists hear of the fact that software has to be tested mostly as a theoretical topic within their two-semester software course. The autodidacts among programmers normally find nothing in their textbooks and programming books, except a note that programs should "of course" be thoroughly tested. Only you won't find how and why in these books, with a few praiseworthy exceptions, like those by Hunt and McManus [98] and Larman and Gutherie [00].

Eventually, developers build their own stock of prejudices and reasons reinforcing their dislike for testing. Here a few examples.

"I have no time for testing."

This frequently heard sentence assumes that testing takes a great deal of time. If you believe this, you will be caught in a vicious circle. The greater the time pressure, the fewer tests; the fewer tests, the more unstable your code. The more unstable your code, the more error reports will fly in from customers. The more error reports, the more debugging time will be required. The more debugging time, the greater the time pressure. ...

On the other hand, if you believe that tests stabilize your code, then this vicious circle will turn into an open spiral. The more stable your code, the less debugging time will be required. The less debugging time, the more time left for development (and tests). This is what this book is about.

"Software testing is boring and mindless."

Common literature about software testing [Binder99, McGregor01] is rather dry and theoretical, scaring off more practically oriented programmers. However, a closer look reveals that the discovery and thus avoidance of software errors is a demanding and creative activity, just like programming itself, more so. Early testing can even help to control the programming process and make it more satisfactory because we gain more confidence in the results of our work. This is what this book is about.

"My code is virtually faultless, good enough in any event."

We as developers like to believe in our own intellectual brilliance. After all, we have read all the books about the issue, have fallen in all the traps, and know all published design patterns plus the details of 363 classes of our own frameworks by heart. Still, sudden doubts creep up at the slightest change to class 276, leaving us wondering what impact that new line of code may have on other parts of the system. Wouldn't it be great if we could use a set of proven and automated tests to check whether an improvement at one end won't inadvertently disturb a function at the other end? This is what this book is about.

"The test department does the testing; they do this much better anyway."

After all, there are exactly the type of pedantic and fussy people in our test department needed for a job like running the same test scripts over and over again. What a pity that test theory provides a few massive indications and proofs that the test department cannot, in fact, do our job, which leads us to the statement of the anti-decomposition axiom. [2] This axiom states that testing a composite system is not sufficient to discover errors in its components. This means that the programmer is responsible for additional testing of his or her components in an isolated environment. Also, errors found at an earlier stage can be removed much faster and at less cost. And this is what this book is about.

[1]In my experience this is a sad truth in the field of plain business application development but—as one reviewer remarked—not in other areas like telecommunications, where intensive unit testing is an absolute must to provide software with the required reliability.

[2]The three test axioms [Weyuker88] will be discussed more closely in Chapter 7.




Unit Testing in Java. How Tests Drive the Code
Unit Testing in Java: How Tests Drive the Code (The Morgan Kaufmann Series in Software Engineering and Programming)
ISBN: 1558608680
EAN: 2147483647
Year: 2003
Pages: 144
Authors: Johannes Link

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net