run tests in what order?

How does IDEA decide what order to run tests in a package? (It's not alphabetical.)

Cheers,
11011011

4 comments
Comment actions Permalink

I'm not sure about details, but conceptually the tests are run in random order. They are rerun with failed tests first however.

0
Comment actions Permalink

I realize that ideally JUnit tests are independent and that the framework doesn't provide a way to determine their order. They appear to be in random order. But I'm debugging a lack of independence in some tests, so I'd like to run them in a particular order.

Generally with tests I prefer deterministic behavior over randomness, because that makes it easier to reproduce and fix bugs.

0
Comment actions Permalink

The only way I've found to control the order of JUnit tests is to enforce the order using nested test suites.

0
Comment actions Permalink

That's an interesting idea, but I don't know how to run a test suite in IDEA's test runner either. http://www.intellij.net/forums/thread.jspa?threadID=252661&tstart=0

0

Please sign in to leave a comment.