website stat

Unit Testing Multi-Thread Java Apps

Although brilliantly conceived with an exceptional use of Design Patterns (after all, one of the mentors of the project is Erich Gamma himself), JUnit is not suitable for multi-threaded applications because it doesn't wait for the threads to finish. A quite rudimentary solution is putting

JAVA:
  1. thread.join();

But still, most of the times you don't have access to the thread instances from within the unit test and it may even be impossible to manage them if they're created somehow randomly.

So, the elegant but extensive solution is using GroboUtils:UnitTesting. Here's another link to get you started.


No Responses to “Unit Testing Multi-Thread Java Apps”

Comments are closed.