First of all I'd like to say thank you, Andy and Dave, for the lots of information and insight you let me draw from the "Pragmatic Programmer" and "Programming Ruby" which I discovered only a few months ago. On my "Ruby way", browsing your web site for the Win32 Ruby package, I found that you also published a book on unit testing. Since your classic book taught me that unit testing is indispensable and I didn't really care for that until then, I decided to deal with this subject. So I headed for Kent Beck's "Test-Driven Development: By Example" which I enjoyed reading a lot - but rather for its literacy and esprit than for its practical use. While Kent Beck fully succeeds in whetting your appetite for unit testing, he does not really provide you with the how-tos (despite the patterns sections). After working through the book, I still don't know how to tackle unit testing in conjunction with refactoring in my everyday practice to produce the sort of "ad hoc design" he advocates (and which admittedly is very appealing). Kent Beck does not mention mock objects and contents himself with desktop application issues which further lessens his book's practical relevance. Anyway, I'd like to further pursue this topic, willingly with the help of your book, should it suit my needs. So let me know: which approach takes "Pragmatic Unit Testing" to the practical issues of testing? Are there recipes how to make the most of unit testing? Do you care for more than just simple applications? Any other recommendations from anyone? Thanks in advance, Manfred
Originally posted by Manfred Mueller: Anyway, I'd like to further pursue this topic, willingly with the help of your book, should it suit my needs. So let me know: which approach takes "Pragmatic Unit Testing" to the practical issues of testing? Are there recipes how to make the most of unit testing? Do you care for more than just simple applications?
Manfred: First, many thanks for the kind words. I'm not sure how to answer the question: I'd like to think it would suit your needs, but... The book follows two threads. The first is a very practical one: it talks about how to write and run unit tests using JUnit. This is a fairly no-nonsense approach: it looks at the various APIs, describes you to use the various setup and teardown facilities, and how to integrate the tests with your code. In parallel, it also discusses _what_ to test: how to know the the tests you're writing are being effective. Throughout we take a pretty practical approach: not much theory, and a fair amount of experience. Cheers
Dave Thomas <br />Author of "<a href="http://www.amazon.com/exec/obidos/ASIN/020161622X/ref=ase_electricporkchop/002-7467239-7061602" target="_blank" rel="nofollow">The Pragmatic Programmer: From Journeyman to Master</a>
Manfred, I want to encourage you to simply start testing those things you see how to test. A complex program really isn't that different from a simple one when it comes to unit testing - at least the complexity shouldn't be that visible at the unit level but should emerge from the collaboration of many small simple units. The same is true about Desktop-, Web- or whatever applications. The meat most often is in the business logic, and that should be mostly independent from the GUI (or persistence or...). Writing unit tests really doesn't differ that much for the most important parts of those applications. There *are* some things that are dependend on the type of application when you want to unit test all parts of it. But you really can start to care about that when you have some experience with unit testing the "easy" parts. Hope this helps...
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus