Eclipse – JUnit tests in eclipse failing when run together

eclipsejunit

I have a set of 44 JUnit tests that I run using Eclipse (I got those tests from someone else – I am new to JUnit tests). When I run them all together, 24 of them fail. However, if I then run the failing ones individually, some of them do pass after all. The tests do take a little time – one of the failing ones for example takes about one or two minutes to complete, while just letting all of them run finishes in just a few seconds.

I am starting multiple tests by right-clicking on the folder they are in and selecting "Run As -> JUnit Test". I am using JUnit 3. Am I doing something wrong in starting them / is there some kind of option I am missing?

Best Answer

It's hard to say for sure without seeing the tests, but it sounds to me like they share some state or resource that is not being reset correctly for the next test.