Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Effective Unit Testing: A guide for Java Developers  RSS feed

Posts: 962
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

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
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?
Why should you try IntelliJ IDEA ?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!