I have a set of 44 JUnit tests that I run using Eclipse (I got these tests from someone else - I'm new to JUnit tests). When I run them all together, 24 of them fail. However, if I then run the failover individually, some of them still pass. Tests take a little time - one of the failed ones, for example, takes about one or two minutes to complete, while simply letting all of them finish in just a few seconds.
I run several tests by right-clicking on the folder in which they are located and selecting "Run As → JUnit Test". I am using JUnit 3. Am I doing something wrong in their launch / is there some kind of option that I am missing?
It is hard to say without seeing the tests, but it seems to me that they are sharing some kind of state or resource that is not reset correctly for the next test.
To expand Gary’s answer by right-clicking and running Run As → JUnit, you cannot guarantee the order in which the tests run, which can also damage the shared resource.
setup() teardown(), reset. , , , - . , , (), ( , ).
GaryF - . , : , , , - ( O/S). , . , , , .