I didn't even know what unit testing was before I picked up this book.
At not much more than 150 pages, this book is small. It's part of a series called "The Pragmatic Starter Kit". That series is part of a larger series of books that started coming out after "The Pragmatic Programmer" was published.
I LOVE what unit testing promises. To be able to incrementally build code that is known to work AND be instantly alerted when you break it is very, very cool.
The book goes over the NUnit framework, walks you through the initial setup, and shows some unit tests in an example project.
After reading this book, I have no idea how to write a useful unit test.
My guess is that it must take a lot of experience to do it well and might even be a bit of an artform.
The book talks about testing principles, fence post errors, mock objects and edge case scenarios. Things like: testing for null or handing a pre-sorted algorithm to a sort algorithm.
None of that really helps me.
Because of this book, I understand why it's a good idea to write unit tests and what the common reasons are that developers give for not writing them.
Even though I scratch my head a lot when I try to write a unit test, I've started using them. I open the book up, look through the examples, and skim the chapters looking for an appropriate example. Most of the time I feel like I'm missing something.
I'm wondering if I need to read a different book, one that has more concrete examples or find an open source project that uses unit tests.
Monday, November 7, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment