From 203076b70e5d6de56ecd3cc9e0302abb88ac2fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Fri, 6 Nov 2026 10:20:36 +0100 Subject: [PATCH] test: run test modules headless unless they need a workbench Test modules use Tycho's default headless harness. A module that needs a workbench opts in by setting tycho.surefire.useUIHarness=true, and fails loudly otherwise, so a new module does not start a workbench by accident. Seven modules need one and opt in: check.core.test, check.ui.test, test.ui.test, checkcfg.core.test, check.test.runtime.tests, sample.helloworld.ui.test and xtext.ui.test. Only these take the Surefire reactor lock (test.reactorConcurrencyLevel=1), since a workbench could take focus from a SWTBot test in another one. The other seven have no workbench and run in parallel under -T. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 5 +++-- com.avaloq.tools.ddk.check.core.test/pom.xml | 5 +++++ com.avaloq.tools.ddk.check.test.runtime.tests/pom.xml | 5 +++++ com.avaloq.tools.ddk.check.ui.test/pom.xml | 5 +++++ com.avaloq.tools.ddk.checkcfg.core.test/pom.xml | 5 +++++ com.avaloq.tools.ddk.sample.helloworld.ui.test/pom.xml | 5 +++++ com.avaloq.tools.ddk.test.ui.test/pom.xml | 5 +++++ com.avaloq.tools.ddk.xtext.ui.test/pom.xml | 5 +++++ ddk-parent/pom.xml | 5 +++-- 9 files changed, 41 insertions(+), 4 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 2790fa2176..209c610e49 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -91,7 +91,7 @@ therefore need `-XstartOnFirstThread`. There are two contexts: ### One JUnit run per test module -Every test bundle (packaging `eclipse-test-plugin`) runs its own tests in its own Eclipse runtime. `tycho-surefire-plugin` is configured once in `ddk-parent/pom.xml`; individual test poms carry no test configuration. Surefire finds the tests by class name, so there are no test suites to maintain. Fragment test bundles work the same way, with their host in the runtime. +Every test bundle (packaging `eclipse-test-plugin`) runs its own tests in its own Eclipse runtime. `tycho-surefire-plugin` is configured once in `ddk-parent/pom.xml`; individual test poms only set the properties below if they need a workbench. Surefire finds the tests by class name, so there are no test suites to maintain. Fragment test bundles work the same way, with their host in the runtime. **Consequences for agents:** @@ -99,7 +99,8 @@ Every test bundle (packaging `eclipse-test-plugin`) runs its own tests in its ow - A new test bundle needs packaging `eclipse-test-plugin` and an entry in the `ddk-parent/pom.xml` modules list. With packaging `eclipse-plugin` its tests do not run. - A module's runtime holds only the dependency closure of its manifest. If a test needs a bundle at runtime, for example a language's UI bundle, declare it in that test bundle's `META-INF/MANIFEST.MF`. - Test classes run in alphabetical order within a module and must not depend on running after other classes. -- With `-T`, test runtimes run one at a time (`reactorConcurrencyLevel` in `ddk-parent/pom.xml`), while everything else stays parallel. `CheckQuickfixTest` failed intermittently on macOS when they overlapped. +- Test modules run headless by default, which is Tycho's default: no workbench starts, so `PlatformUI.getWorkbench()` and any Guice injector that needs `IWorkbench` fail. A module that needs a workbench sets `tycho.surefire.useUIHarness` to `true` and `test.reactorConcurrencyLevel` to `1` in its pom's ``. +- With `-T`, headless modules run in parallel while modules with a workbench take turns (`test.reactorConcurrencyLevel`). `CheckQuickfixTest` has failed intermittently on macOS when workbenches overlapped; rerun serially before debugging such a failure. - A failed module's tests leave their log in `/target/work/data/.metadata/.log`. CI archives these logs for failed builds. - To run the tests of one UI bundle from Eclipse, use its launch configuration (e.g. `com.avaloq.tools.ddk.check.ui.test/CheckUiTests.launch`), which runs all tests of the project via JUnit discovery in Eclipse. diff --git a/com.avaloq.tools.ddk.check.core.test/pom.xml b/com.avaloq.tools.ddk.check.core.test/pom.xml index 4e7df161c8..f2eb23ebe1 100644 --- a/com.avaloq.tools.ddk.check.core.test/pom.xml +++ b/com.avaloq.tools.ddk.check.core.test/pom.xml @@ -10,4 +10,9 @@ com.avaloq.tools.ddk.check.core.test eclipse-test-plugin + + + true + 1 + \ No newline at end of file diff --git a/com.avaloq.tools.ddk.check.test.runtime.tests/pom.xml b/com.avaloq.tools.ddk.check.test.runtime.tests/pom.xml index 2a88da8aed..bcf355715e 100644 --- a/com.avaloq.tools.ddk.check.test.runtime.tests/pom.xml +++ b/com.avaloq.tools.ddk.check.test.runtime.tests/pom.xml @@ -10,4 +10,9 @@ com.avaloq.tools.ddk.check.test.runtime.tests eclipse-test-plugin + + + true + 1 + \ No newline at end of file diff --git a/com.avaloq.tools.ddk.check.ui.test/pom.xml b/com.avaloq.tools.ddk.check.ui.test/pom.xml index ede57d3fc2..1548bfb0ea 100644 --- a/com.avaloq.tools.ddk.check.ui.test/pom.xml +++ b/com.avaloq.tools.ddk.check.ui.test/pom.xml @@ -10,4 +10,9 @@ com.avaloq.tools.ddk.check.ui.test eclipse-test-plugin + + + true + 1 + \ No newline at end of file diff --git a/com.avaloq.tools.ddk.checkcfg.core.test/pom.xml b/com.avaloq.tools.ddk.checkcfg.core.test/pom.xml index cb5a4db006..d87ee60111 100644 --- a/com.avaloq.tools.ddk.checkcfg.core.test/pom.xml +++ b/com.avaloq.tools.ddk.checkcfg.core.test/pom.xml @@ -10,4 +10,9 @@ com.avaloq.tools.ddk.checkcfg.core.test eclipse-test-plugin + + + true + 1 + \ No newline at end of file diff --git a/com.avaloq.tools.ddk.sample.helloworld.ui.test/pom.xml b/com.avaloq.tools.ddk.sample.helloworld.ui.test/pom.xml index 67e75318d7..42d25e9387 100644 --- a/com.avaloq.tools.ddk.sample.helloworld.ui.test/pom.xml +++ b/com.avaloq.tools.ddk.sample.helloworld.ui.test/pom.xml @@ -10,4 +10,9 @@ com.avaloq.tools.ddk com.avaloq.tools.ddk.sample.helloworld.ui.test eclipse-test-plugin + + + true + 1 + diff --git a/com.avaloq.tools.ddk.test.ui.test/pom.xml b/com.avaloq.tools.ddk.test.ui.test/pom.xml index 230b40f78a..b53feeaa9b 100644 --- a/com.avaloq.tools.ddk.test.ui.test/pom.xml +++ b/com.avaloq.tools.ddk.test.ui.test/pom.xml @@ -10,4 +10,9 @@ com.avaloq.tools.ddk.test.ui.test eclipse-test-plugin + + + true + 1 + diff --git a/com.avaloq.tools.ddk.xtext.ui.test/pom.xml b/com.avaloq.tools.ddk.xtext.ui.test/pom.xml index b387573448..fa1b9e9754 100644 --- a/com.avaloq.tools.ddk.xtext.ui.test/pom.xml +++ b/com.avaloq.tools.ddk.xtext.ui.test/pom.xml @@ -10,4 +10,9 @@ com.avaloq.tools.ddk.xtext.ui.test eclipse-test-plugin + + + true + 1 + \ No newline at end of file diff --git a/ddk-parent/pom.xml b/ddk-parent/pom.xml index 94c86cc688..091c49ec62 100644 --- a/ddk-parent/pom.xml +++ b/ddk-parent/pom.xml @@ -41,6 +41,8 @@ ${runtime.javaOptions} 1800 + + 0 [3.9.0,3.10) @@ -273,8 +275,7 @@ junit6 false false - true - 1 + ${test.reactorConcurrencyLevel} ${test.timeout} -Dslf4j.internal.verbosity=ERROR -Dlogback.configurationFile="${runtime.logbackConfig}" ${test.javaOptions} -pluginCustomization ${runtime.pluginCustomization}