Sebastopol, CA--According to author Paul Hamill, most people who write software have at least some experience with unit testing, even if they don't think of it that way. "If you have ever written a few lines of throwaway code just to try something out, you've built a unit test," says Hamill. "On the other end of the software spectrum, many large-scale applications have huge batteries of test cases that are repeatedly run and added to throughout the development process. Unit tests are useful at all levels of programming."
But what are unit tests and how are they run? In his new book Unit Test Frameworks (O'Reilly, US $29.95), Hamill covers the usage, philosophy, and architecture of unit test frameworks as he answers this question. He explains that unit test frameworks are software tools to support writing and running tests, including a foundation on which to build tests and the functionality to execute the tests and report their results. "They are not solely tools for testing," says Hamill. "They can also be used as development tools on a par with preprocessors and debuggers. Unit tests frameworks can contribute to almost every stage of software development, including software architecture and design, code implementation and debugging, performance optimization, and quality assurance."
Until now, there has been little documentation available on unit testing, and most sources addressed specific frameworks and specific languages, rather than explaining the use of unit testing as a language-independent, standalone development methodology. Hamill begins by having the reader build a simple unit test framework from the ground up. The xUnit architecture is presented, using the JUnit framework as the reference implementation of xUnit. Readers will progressively build an example application to demonstrate common practices and patterns of unit test development.
With step-by-step instruction in basic unit test development, Unit Test Frameworks provides useful code examples in both Java and C++, and includes details on some of the most commonly used frameworks today from the xUnit family, including JUnit for Java, CppUnit for C++, and NUnit for .NET. The book includes clear, concise, and detailed descriptions of:
The tutorials and example code included in Unit Test Frameworks are platform-independent and compatible with Windows, Mac OS X, Unix, and Linux. The book's companion CD includes complete versions of JUnit, CppUnit, NUnit, and XMLUnit, as well as the complete set of code examples.
- Chapter 3, "The xUnit Family of Unit Test Frameworks"
- For more information about the book, including table of contents, index, author bio, and samples
- A cover graphic in JPEG format
O’Reilly Media spreads the knowledge of innovators through its books, online services, magazines, and conferences. Since 1978, O’Reilly Media has been a chronicler and catalyst of cutting-edge development, homing in on the technology trends that really matter and spurring their adoption by amplifying “faint signals” from the alpha geeks who are creating the future. An active participant in the technology community, the company has a long history of advocacy, meme-making, and evangelism.