Book Image

Test-Driven Java Development

Book Image

Test-Driven Java Development

Overview of this book

Table of Contents (17 chapters)
Test-Driven Java Development
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
8
Refactoring Legacy Code – Making it Young Again
Index

Unit testing


Frequent manual testing is too impractical to any but the smallest systems. The only way around this is the usage of automated tests. They are the only effective method to reduce the time and cost of building, deploying, and maintaining applications. In order to effectively manage applications, it is of the utmost importance that both the implementation and test code are as simple as possible. Simplicity is one of the core Extreme Programming (XP) values (http://www.extremeprogramming.org/rules/simple.html) and the key to TDD and programming in general. It is most often accomplished through division into small units. In Java, units are methods. Being the smallest, feedback loop they provide is the fastest so we spend most of our time thinking and working on them. As a counterpart to implementation methods, unit tests should constitute by far the biggest percentage of all tests.

What is unit testing?

Unit testing (UT) is a practice that forces us to test small, individual and...