Unit Testing Multi-Thread Java Apps
- Published April 17th, 2007 in Java
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
-
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”