Have you gone through three years of computer science bachelor degree fun (or anything similar) and pretty much not heard a word about testing? Or have you heard from all your teachers that testing is extremely important, but never learned how to even write one? That has been the case for me. Testing is important, you all got to do it, it is very important, always test, do it a lot! Well, sure… but how do I do it? How do I write one of these tests?
The last book I finished is called The Art of Unit Testing, and I am so happy that I stumbled over that book. Spring 2009 I was at a developer conference called NDC 2009 (Norwegian Developer Conference) and it was really great. If you have the time, you should go to that website and have a look. You can watch most of the talks there online. Anyways, the second day I attended a series of talks about Test Driven Development with a great speaker called Roy Osherove. I learned a bunch and decided that TDD looks like something I should try to learn. However, I had a big problem. I didn’t even know how to write a test. And doing TDD without knowing how to write a test is kind of difficult… to say the least…
Anyways, this Roy Osherove person advertised that he had just finished a book about pretty much exactly that; writing unit tests. So, I decided to get myself a copy of it.
It was great! Seriously learned a lot. It covers the following subjects (yes, that would be the table of contents).
- The basics of unit testing
- A first unit test
- Using stubs to break dependencies
- Interaction testing using mock objects
- Isolation (mock object) frameworks
- Test hierarchies and organization
- The pillars of good tests
- Integrating unit testing into the organization
- Design and testability (Appendix A)
- Extra tools and frameworks (Appendix B)
It is only 283 pages long (including the appendixes) and a pretty quick and easy read. Which I like. I got sucked in, and it was finished fast. Probably should read it again some time But anyways: I previously did not even know how to write a single unit test in any language. Now I do
You can get it from for example Manning (who is the publisher) or from Amazon. I would probably get it from Amazon since they seem to have a 34% discount currently… Except I already have it, of course
If you want to learn how to do unit testing, I can recommend it with all my heart
Oh, by the way, when you buy this book, you even get a free eBook version of it! Which is totally brilliant, since then you can have the book and read it at home, but you can also for example put the eBook version on your netbook and read while travelling. Awesome all the way 8) Wish more publishers or authors (or whoever decides) were like that…