The book starts with an introduction to unit testing, and describes the problem it solves. From there, the “how” of the process is covered, including what to test, what not to test, and how to set up test code. Later on, a chapter is dedicated to using mock objects to simplify tests. Discussion includes manual mocks, and the use of frameworks such as NMock.
Towards the end, design considerations are mentioned. The book emphasizes designing for testability, test-driven development, and refactoring code to enable testing. Following the design considerations, some coverage is given to automated UI testing, and how it relates to unit tests. Specific points are made for testing various UIs, including WinForms, WebForms, and command-lines.
The book is easy to read – the text is not dense, and each page gets read through quickly. The book itself is a slim one, at just 227 pages, including index and appendices. I did not need very long to read it!
The code samples are all in C#, and the primary tool used is NUnit, but the concepts presented and accompanying discussion apply to most any programming language and testing tool.
Overall, this book gives a nice overview of unit testing, and hits on the main points of what, how, and why. But beyond that, it does not go into the subject into much depth. And the way it is written presents it as learning material, not a reference. If you are already familiar with NUnit and unit testing, you may not get much from this book.





Comments
Comments are open, so have your say!
Trackbacks