Repository navigation
test: run each test bundle in its own runtime with JUnit discovery - #1599
joaodinissf wants to merge 5 commits into
Conversation
6854e70 to
9d1e10e
Compare
| @@ -1,43 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||
There was a problem hiding this comment.
I think that for the UI tests we still need the launch configurations, which can be adapted to use JUnit discovery. For the core tests, I agree we can close them
There was a problem hiding this comment.
Kept as CheckUiTests.launch, XtextUiTests.launch and DdkTestUiTests.launch, each running all tests of its project via JUnit discovery. AllTests DDK.launch is gone.
Posted by Claude Code on behalf of @joaodinissf.
| * JUnit's default scanner only sees the classes of the test bundle itself, so package selectors such as the one in {@link AllTests} would miss the | ||
| * tests of all other bundles in the test runtime. This scanner is registered via {@code META-INF/services}. | ||
| */ | ||
| public class OsgiClasspathScanner implements ClasspathScanner { |
There was a problem hiding this comment.
I think this is weird. We should just have different junit runs for each plugin, and not have a single entry point. It is true that is a bit more expensive but not worth the complexity, let us just do plain Junit, once test execution per module
There was a problem hiding this comment.
Removed. Each test bundle now has its own plain JUnit run, configured once in ddk-parent.
Posted by Claude Code on behalf of @joaodinissf.
| DdkTestSuite.class | ||
| }) | ||
| // @Format-On | ||
| @SelectPackages("com.avaloq.tools.ddk") |
There was a problem hiding this comment.
And completely remove this class
There was a problem hiding this comment.
Removed.
Posted by Claude Code on behalf of @joaodinissf.
103d89e to
77265e5
Compare
9d1ae7f to
3e90c8f
Compare
|
I know that you can run a build in parallel with -T 3 and still tell maven surefire (or maybe Tycho, I am not sure of the details) that UI tests execution must be serialized. Could you look into that? |
3e90c8f to
0786bf7
Compare
|
Yes, Tycho's In a full local Posted by Claude Code on behalf of @joaodinissf. |
0786bf7 to
7b80500
Compare
…ests The generated CheckInjectorProvider restores the global EMF registries to a copy taken on its first use, not to the state before each test. When that first use precedes the activation of the Check UI plug-in, every later standalone Check test wipes the Check validator the UI plug-in has registered since. Tests using the UI injector, such as CheckApiAccessValidationsTest and CheckValidationTest, then validate without any Check validator and miss the expected issues. The hand-maintained suites only avoided this by their order. Add RegistryIsolatingCheckInjectorProvider, which restores the state from before each test, and use it in the standalone Check tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
These tests were never part of the aggregated test run and had rotted: - ErrorLogListenerTest ignored a location named after the old class name of the test, and checked the log before the job manager had logged the failure. Wait for the logged exception, and also assert that it is ignored. - DeChKeyboardLayoutTest referenced the layout under a package which no longer exists. SWTBot fixes its keyboard layout globally on first use, so typing with DE_CH would also break all later SWTBot tests; check the layout's keystrokes directly instead. - SwtBotRadioTest opened the preferences via the Window menu, which does not exist on macOS, and changed a workbench preference. Use a shell of its own with a radio group and look the buttons up within it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BugAig1084, BugAig830, BugAig1314 and BugDsl27 are the only test classes whose names do not end in Test or Tests, which automatic test discovery by class name relies on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
All tests ran in the single OSGi runtime of com.avaloq.tools.ddk.xtext.test, through AllTests and one hand-maintained @suite per test bundle. A test class not listed in a suite never ran, and the tests of com.avaloq.tools.ddk.test.ui.test were not referenced at all. Each eclipse-test-plugin bundle now runs its own tests in its own runtime. tycho-surefire-plugin is configured once in ddk-parent and finds the test classes by name, so a new test class needs no registration. Classes run in alphabetical order within a module, and the timeout applies per module. AllTests, the suites, their launch configurations and the JUnit suite dependencies are removed. The UI test bundles keep a launch configuration each, which runs all tests of the project via JUnit discovery in Eclipse. These launches and the Maven test runs use the org.eclipse.platform.ide product, as the target platform has no org.eclipse.sdk bundle. com.avaloq.tools.ddk.checkcfg.ui.test only held an empty suite, so the bundle is removed. With -T, test runtimes run one at a time through reactorConcurrencyLevel, as they never overlapped with the single runtime before, and CheckQuickfixTest failed intermittently on macOS when they did. Everything else stays parallel, and a build without -T is unaffected. Two bundles relied on the shared runtime. The packaging of com.avaloq.tools.ddk.check.test.runtime.tests is now eclipse-test-plugin, as its tests would not run otherwise. com.avaloq.tools.ddk.checkcfg.core.test now declares its runtime dependencies on com.avaloq.tools.ddk.check.test.runtime.ui and com.avaloq.tools.ddk.check.ui. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t logs With one test run per module, a single surefire report no longer shows that the tests ran. The check now requires a report for every concrete class declaring tests, which also catches a test bundle not packaged as eclipse-test-plugin, a class name Surefire does not include and a module the reactor skipped. Failed builds now archive the workspace log of every test module. The log of xtext.test was never archived: upload-artifact ignores hidden files by default, so the step found no files for .metadata/.log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7b80500 to
4d5163b
Compare
Summary
Each test bundle now runs its own tests in its own Eclipse runtime. A new test class needs no registration, and the hand-maintained
*TestSuiteclasses andAllTestsare gone.tycho-surefire-pluginis configured once inddk-parent/pom.xml. Individual test poms carry no test configuration.*Test,*Tests,Test*,*TestCase. Classes run in alphabetical order within a module, and the 30-minute timeout applies per module.*TestSuiteclasses, the twoAllTestsclasses, their launch configurations and the JUnit suite dependencies of the test bundles are removed.ddk-target/ddk.targetkeeps its two JUnit suite units, as Tycho's JUnit 6 provider imports those packages. The UI test bundles keep a launch configuration (CheckUiTests.launch,XtextUiTests.launch,DdkTestUiTests.launch) which runs all tests of the project via JUnit discovery in Eclipse. These launches and the Maven test runs use theorg.eclipse.platform.ideproduct, asddk-target/ddk.targethas noorg.eclipse.sdkbundle.com.avaloq.tools.ddk.checkcfg.ui.testonly held an empty suite, so the bundle is removed.com.avaloq.tools.ddk.xtext.testno longer exports its now emptycom.avaloq.tools.ddk.xtextpackage.AGENTS.mddescribes the new setup.Changes the per-module runs need
com.avaloq.tools.ddk.check.test.runtime.testsis now packaged aseclipse-test-plugin. Aseclipse-plugin, its tests would not run.com.avaloq.tools.ddk.checkcfg.core.testnow declarescom.avaloq.tools.ddk.check.test.runtime.uiandcom.avaloq.tools.ddk.check.ui. Six of its tests failed without them, as they relied on bundles the shared runtime happened to contain.CI
check-surefire-reports.shnow requires a report for every concrete class declaring tests, instead of any single report. This catches a test bundle with the wrong packaging, a class name Surefire does not include and a module the reactor skipped. Classes which only inherit their tests are not covered..metadata/.logof every test module. The log ofxtext.testwas never archived, asupload-artifactignores hidden files by default (include-hidden-filesis now set).Fixes surfaced by the switch
CheckInjectorProviderrestores the global EMF registries to a copy taken on its first use. If that first use precedes the activation of the Check UI plug-in, every later standalone Check test wipes the Check validator registered since. The newRegistryIsolatingCheckInjectorProviderrestores the state from before each test, and the standalone Check tests use it.BugAig1084,BugAig830,BugAig1314,BugDsl27are renamed to…Test, as Surefire would not include them otherwise.com.avaloq.tools.ddk.test.ui.testwas never referenced byAllTests, and its three test classes had rotted. They now run and pass:ErrorLogListenerTestignored a location named after the test's old class name, and checked the log before the job manager logged the failure.DeChKeyboardLayoutTestreferenced the layout under a package which no longer exists. It now checks the layout's keystrokes directly, as typing with it would change SWTBot's global keyboard layout for all later tests.SwtBotRadioTestopened the preferences via the Window menu, which does not exist on macOS, and changed a workbench preference. It now uses a shell of its own.Test set before and after
Both columns are local
clean verifyruns on macOS with Temurin 21, compared test by test: "before" is master at55b37d0e8, "after" is this branch, which also ran all quality checks. Linux, which CI uses, was not run locally.BugAig1084,BugAig830,BugAig1314,BugDsl27→…Test(same tests).ErrorLogListenerTest(1),DeChKeyboardLayoutTest(1),SwtBotRadioTest(2).Cost and behaviour
-T, test runtimes run one at a time throughreactorConcurrencyLevel, as they never overlapped with the single runtime before.CheckQuickfixTestfailed intermittently on macOS when they did, and passed in all serial runs. Everything else stays parallel, and CI builds without-T.-T 3Cruns. Without the lock,-T 3Ctook 188 s and 210 s, with up to 4 test runtimes at once.--fail-at-end, a failure incheck.core.testskips the 36 tests ofcheck.ui.test,check.test.runtime.testsandsample.helloworld.ui.test, which depend on it. They run once the failure is fixed.🤖 Generated with Claude Code