Or you can override the suite method to explicitly register the tests to
run. This should maintain the order.
Dimitris Andreadis wrote:
I started looking into some Jrockit failures and I realized that the
execution order of Junit tests inside a class *MAY BE THE REVERSE* when
running with Jrockit, compared to using sun's JVM.
This boils down to Class.getMethods()/getDeclaredMethods() returnings
methods in an undefined order:
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Class.html#getMethods(
)
Other people have stumbled on this before and the verdict seems to be
that tests should be re-written to work in any order:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=142528
http://mail-archive.objectweb.org/howl/2005-11/msg00058.html
I'm certain there are places in our testsuite that really depend on the
execution order, in fact this could explain the majority of jrockit
failures, so unless we isolate and conditionally execute those tests, we
need to fix them!