The Art of Unit Testing![]() With Examples in .NET Roy Osherove MEAP Release: September 2007 Softbound print: January 2009 (est.) | 400 pages ISBN: 1933988274 |
|||
| Start Reading The Art of Unit Testing today through the Manning Early Access Program | |||
| MEAP OPTIONS* | |||
| MEAP + Ebook only - $24.99 | |||
| MEAP + Print book + Ebook Combo - $44.99 | |||
| Print book only - $39.99 (Not yet available for order) | |||
| * Download early chapters in PDF format! For more information, please see the MEAP FAQs page. | |||
| About MEAP Release Date Estimates | |||
Table of Contents, MEAP Chapters & Resources
| Table of Contents | Resources | |
|
Part I Getting started
1. The basics of unit testing - FREE 2. The first unit test - AVAILABLE Part II Core techniques 3. Using Stubs to break dependencies - AVAILABLE 4. Interaction testing Using Mock Objects - AVAILABLE 5. Mock Object frameworks - AVAILABLE Part III The test code 6. Test hierarchies and organization - AVAILABLE 7. The pillars of good tests - AVAILABLE |
Part IV Design and process
8. Integrating unit testing into the organization - AVAILABLE 9. Designing for testability 10. Testing legacy systems Appendix I Integration Testing With Unit Test Frameworks Appendix II Unit testing resources |
|
DESCRIPTION
Most developers recognize the value of unit testing—the independent testing of individual chunks, units, of code by the developer while an application is being written. Unit testing leads to easier maintenance, troubleshooting, refactoring, and integration testing of the application. To facilitate unit testing, the developer uses unit-testing frameworks such as NUnit along with various helper frameworks for more advanced testing of interaction between objects—often called "Mock Object frameworks."
Because there are few clear and defined ways on how to write unit tests well, many shops try to implement unit tests on their code, realizing too late that the tests hinder the coding cycle more than they help. This book will help you avoid mistakes when writing unit tests, and show you how to do it right—from the beginning steps to the most advanced techniques.
The Art of Unit Testing guides the reader on the journey from beginner to master in the subtle art of unit testing. Based on expert author Roy Osherove's real-world development experiences, this book shows developers how to make sure the code that they write actually works as expected, and how to make these verifications as automated as possible. Not only that, the book shows techniques that help to make sure that the tests are maintainable, readable, and test the right thing over time, avoiding the "throw-away tests" phenomenon that plagues many shops that try to write unit tests without clear guidelines. In this way it helps you make your development process—and your business—more agile.
The Art of Unit Testing starts out with the basics of how to write unit tests, what makes a good unit test, and how to avoid the pitfalls you may encounter when you try to write unit tests. You'll learn to build tests that are readable, accurate, and maintainable. Along the way, you'll pick up a set of best practices and how-tos for key subjects, from using test frameworks to using Mock Objects to writing tests that run against a database.
The author establishes five rules for good unit tests built upon the three major principles that any good test be maintainable, trustworthy, and readable. You'll find clear sections presenting established best practices to ensure that your tests will adhere to these principles. The book also provides clear guidance on what to test and where to start testing when you're going into a legacy code project.
Unlike other books on this topic, this book trades theory for real-world examples. It's designed so that you, a working developer, can start writing better unit tests now.
WHAT'S INSIDE:
- Introduction to unit testing and the basics of writing real-world unit tests with NUnit
- Best practices for writing maintainable, trustworthy, readable tests
- Mock Objects and interation testing in-depth
- Reference chapters for NUnit, Rhino.Mocks, and TypeMock.NET
- Database unit testing
- Testing legacy code
- Designing for testability
About the Authors
For over a decade, Roy Osherove has been involved with the software industry as a developer, lead, manager, and architect on various projects. Roy speaks at international conferences such as TechEd, DevTeach, JAOO, DevDays, and more about subjects relating to Agile development, unit testing and test-driven development. He's the founder of the Agile Israel User group and consults and trains teams around the world on the gentle art of unit testing and TDD. You can find out more about Roy on his blog at ISerializable - Roy Osherove's Blog.
About the Early Access Version
This Early Access version of The Art of Unit Testing enables you to receive new chapters as they are being written. You can also interact with the authors to ask questions, provide feedback and errata, and help shape the final manuscript on the Author Forum
Want to learn More?
Sign up to read more content when it is released and to receive news about this book.


