views:

111

answers:

1

Hi,

when i run multiple JUnit tests in a row, does JUnit create a new thread for each execution or everything is wrapped in a single thread?

Thanks

+4  A: 

It's all on a single thread. You don't say how you're invoking the tests, but for example, running a TestSuite will run all the tests in the suite sequentially.

If you want parallel execution, TestNG has support for running tests concurrently, as does JUnitPerf and GroboUtils.

mdma
Yishai
Also, when you run in a Maven build, you can have each JUnit test set run in it's own environment - not just it's own thread.
aperkins