开发者

Running each JUnit test in a separate JVM in Eclipse?

开发者 https://www.devze.com 2022-12-31 22:09 出处:网络
I have a project with nearly 500 individual tests in around 200 test classes. Some of these tests don\'t do a great job of tearing down their own state after they\'re finished, and in Eclipse this res

I have a project with nearly 500 individual tests in around 200 test classes. Some of these tests don't do a great job of tearing down their own state after they're finished, and in Eclipse this results in some tests failing. The tests all pass when runni开发者_C百科ng the test suite from the command line via Ant.

Can I enable 'test isolation' somehow in Eclipse? I don't mind if it takes longer to run.

Long term, I will clean up the misbehaving tests, but in the short term I'd like to get the tests working.


If you use Ant in Eclipse, you can set the JUnit task to fork a new JVM process for each test, providing isolation.

http://ant.apache.org/manual/Tasks/junit.html


I also had similar needs and developed small maven plugin Jute which has been published in maven central. It starts external JVM process for each JUnit test method.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号