aspose file tools*
The moose likes Book Reviews and the fly likes Effective Unit Testing: A guide for Java Developers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Books » Book Reviews
Bookmark "Effective Unit Testing: A guide for Java Developers" Watch "Effective Unit Testing: A guide for Java Developers" New topic
Author

Effective Unit Testing: A guide for Java Developers

Book Review Team
Bartender

Joined: Feb 15, 2002
Posts: 944
Author/s    : Lasse Koskela
Publisher   : Manning Publications
Category   : Advanced Java
Review by : Jeanne Boyarsky
Rating        : 10 horseshoes

"Effective Unit Testing" felt familiar to me. I think it is because I read "Test Driven" and saw the author present some of the content from this title at the 2012 Server Side Java Symposium. You can get a feel for some of the smells from my live blog post of that session http://www.selikoff.net/2011/03/16/test-smells-breakout-at-the-server-side-java-symposium/

Part one sets the stage. It walks you through a hypothetical teams journey - no tests → tests → test driven! I liked the examples of bad code and bad test examples. And I really like the explanation of different types of test doubles. I also liked the example of jMock vs Mockito to do the same thing.

Part two shows you a series of test smells and how to fix them. One of my favorites is something really simple. How to make a bowling example more readable by using method names so you can embed "magic values" in the code. I also particularly liked the segment on how parameterized tests can be an anti-pattern along with how to avoid this problem.

Part three is "other things." It covers using other JVM languages to test and how to make your tests faster. Both via the tests and running them in the cloud. I really liked the part on how to profile in both Ant (which I knew) and Maven (which I haven't needed to yet.)

While there is an appendix to get you up to speed on JUnit, you should read a different book if you are trying to get up to speed on JUnit. I recommend "JUnit in Action" or "Test Driven" for that. Once you know any unit testing framework, it is time to come back to this book so you can write better tests.

It was a great book. My only problem was that having seen the session some was repetitive. But I highly recommend both the book and the talk.

---
Disclosure: I received a copy of this book from the publisher in exchange for writing this review on behalf of CodeRanch.

More info at Amazon.com
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Effective Unit Testing: A guide for Java Developers