Should execution order depend on TestEngine service discovery order? #4855
Replies: 1 comment
-
That sounds like a serious issue with Tycho that might cause other issues as well. I'd definitely recommend you getting to the bottom of that.
The However, for some For example, we could introduce the following interface and allow setting it via a system property: interface ServiceLoaderOrderer {
Optional<Comparator<? super T>> provideComparator(Class<T> service);
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have a question regarding test execution order, and its dependence to how the
org.junit.platform.engine.TestEngine
services are discovered in the JVM.Should this code order test engines explicitly?
org.junit.platform.launcher.core.LauncherFactory.collectTestEngines(LauncherConfig)
It seems that class loading can lead to different test engine order, which leads to different test execution order. This is from my POV not great.
Here is a small example of some test suites:
jep4194_discovery_call.zip
The file structure is:
I can run the tests with:
And I can run the tests with:
Specifying a different
-cp
resulting in a different test order comes as a bit of a surprise to me. My impression was that the execution order of tests was stable. In the Eclipse case we have a class loader that seems to cause different order of test engines (I'm still debugging that); its not a question of having a different command line that leads to different test order.Background:
I'm looking into an issue when running Eclipse tests with
mvn
andtycho-surefire
: eclipse-jdt/eclipse.jdt.ui#2423One part of the issue is instable test order - we had a test that didn't properly handle resource clean-up. However, only some CI jobs would run into failures. This is due to instable test order - sometimes the "bad" test would run "first" and result in som following failing. But more often it would run last, resulting in no failures.
From debugging, it looks like
tycho
code will discover services in an unstable order, resulting in an unstable order inLauncherFactory.collectTestEngines()
. This means the Eclipse JDT UI mixture of JUnit 4, JUnit 5 and test suites results in sometimes running test suites first, sometimes running JUnit 4 tests first, sometimes running JUnit 5 tests first - depending on the order of how engines were collected (depending on how services were discovered).Best regards and thanks,
Simeon
Beta Was this translation helpful? Give feedback.
All reactions