This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Effective Unit Testing:Unit testing multi threading

 
Zico Gupta
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Lasse,
I consider myself one of the lucky person having received one on one training from you in junit.

Coming to the new book, does it cover unit testing code which is written to run a multi threaded environment? Also please recommend some mocking tool.

Best Regards,
Zico
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zico Gupta wrote:I consider myself one of the lucky person having received one on one training from you in junit.

That's nice to hear In case you're interested in TDD (or some of your colleagues are), I'm running a one-day workshop on TDD in Bangalore next week during the Agile India conference. I believe there's still seats available in that workshop.

Zico Gupta wrote:Coming to the new book, does it cover unit testing code which is written to run a multi threaded environment?

Not in very much detail. The most in depth coverage is in chapter 5, which describes a test smell called "sleeping snail" – a test that uses Thread.sleep(...) to wait that some thread has managed to complete its work before the test continues with assertions or further invocations.

In fact, Test Driven covers it in more detail than Effective Unit Testing – the whole chapter 7 is dedicated to dealing with threads.

Zico Gupta wrote:Also please recommend some mocking tool.

My personal favorite is Mockito. I'm sure some other libraries have some really advanced functionality that Mockito's missing but so far I haven't found a need for anything more capable. Actually, most of the time when I feel like I'm stretching Mockito to its limits, the real issue isn't Mockito but the design of the code I'm trying to mock.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic