Cedric mentioned today that the book he and Hani have been working on, Next Generation Java Testing, is now available for pre-order on Amazon.
I was a technical reviewer on this book way back in March and in general I would give it high marks. The book covers Test NG, patterns of unit testing, Java EE testing, performance testing, mocks, how to deal with external resources like databases and legacy systems, tools, etc. Generally, if you have questions on developer testing, I think you can probably find something in here about it. Having done a lot of developer testing myself, I have a lot of thoughts on the subject and I think the patterns section in particular should be essential reading for new developers just starting to write unit tests.
For readers of Hani’s Bile Blog, you will recognize the opinionated nature of some of the advice. Obviously, it’s toned way down but there were some sections (most notably those in the Digressions chapter) that seemed more like rants than advice and were only lightly backed by evidence. I still enjoyed reading those sections even when I didn’t agree. Hopefully some of those sections have been fleshed out a tad more in the final revision.
At the beginning, I thought the book suffered a bit from being both a “TestNG book” and a more generic “developer testing handbook” but by the end I could see that these subjects are inseparable for the authors as they are working to make TestNG solve the problems they’ve found while doing developer testing. As a long-time JUnit user (and a TestNG newbie), I must admit that I found TestNG compelling for many reasons as I read the book. Ultimately, the strongest parts of the book are those that describe general testing techniques and problems. To their credit, JUnit is covered extensively throughout the book and typical JUnit solutions to the problems they discuss are covered as well (along with usually better solutions in TestNG).
I think on the whole the advice given is good and well-reasoned and I would recommend the book to any developer. I think it would be most useful to younger developers still honing their testing skills, but I think there is something in this book for even the most seasoned developer. A thorough understanding of developer testing is a requirement for any working developer today and this book covers the space admirably.