Concurrent JUnit testing

Are you fixed to JUnit? TestNG provides good multi thread testing out of the box and it’s compatible with JUnit tests (you need to make a few changes). For example you could run a test like this:

@Test(threadPoolSize = 3, invocationCount = 9,  timeOut = 10000)
public void doSomething() {
...
}

This would mean that the doSomething() method will be invoked 9 times by 3 different threads.

I highly recommend TestNG.

Leave a Comment