Skip to content

Extract pure matching helpers from QuickAccessMatcher for unit testing#3904

Merged
vogella merged 1 commit intoeclipse-platform:masterfrom
vogella:refactor/quickaccess-pure-matching
Apr 21, 2026
Merged

Extract pure matching helpers from QuickAccessMatcher for unit testing#3904
vogella merged 1 commit intoeclipse-platform:masterfrom
vogella:refactor/quickaccess-pure-matching

Conversation

@vogella
Copy link
Copy Markdown
Contributor

@vogella vogella commented Apr 19, 2026

Summary

  • Move pattern building (whitespace, wildcard, safeCompile) and the substring match-quality computation out of QuickAccessMatcher into a new package-private QuickAccessMatching class of pure static functions. QuickAccessMatcher delegates to the helpers and keeps its per-instance pattern cache; behaviour is preserved.
  • Add a new JUnit 5 QuickAccessMatchingTest (12 tests) covering substring quality tiers (perfect / excellent / good / partial / miss), whitespace and wildcard pattern construction, case-insensitivity, consecutive-star squashing, and the safeCompile fallback for invalid regex. Wired into QuickAccessTestSuite.

Why

The existing quick-access tests (ContentMatchesTest, QuickAccessDialogTest) all open a real QuickAccessDialog, start a workbench window, and poll the results table with DisplayHelper.waitForCondition using 3000-5000 ms timeouts, on top of a one-time workbench-startup tax for the whole tests bundle. That makes adding broad coverage for matcher rules expensive and flake-prone, so the existing suite only touches ranking indirectly through the dialog.

Measured locally, the 12 new pure tests run in 44 ms total (about 3.7 ms per test) via the JUnit console launcher. Beyond the speedup, the new tests need no Display, no X server, and no UI harness, so they cannot flake on timing. This opens the door to covering more matcher rules (tier boundaries, wildcard edge cases, regex safety) as pure unit tests.

Test plan

  • mvn compile for org.eclipse.ui.workbench and org.eclipse.ui.tests succeeds.
  • QuickAccessMatchingTest passes directly via the JUnit 5 console launcher (12/12 in 44 ms) against the freshly built classes.
  • Full aggregator CI runs the existing QuickAccessTestSuite (including the new test class) green.
  • Spot-check quick-access UX in a sanity launch: exact match, prefix, substring, * / ? wildcards, multi-word filter.

Note: under -Pbuild-individual-bundles, Tycho resolves org.eclipse.ui.workbench from the p2 target platform at test runtime, so the new class is not visible to that profile's surefire run. CI and PDE launches build the workbench from the workspace and pick it up.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 19, 2026

Test Results

   852 files  ± 0     852 suites  ±0   58m 38s ⏱️ + 3m 42s
 7 911 tests +12   7 668 ✅ +12  243 💤 ±0  0 ❌ ±0 
20 235 runs  +36  19 580 ✅ +36  655 💤 ±0  0 ❌ ±0 

Results for commit c7fe4bb. ± Comparison against base commit b6b40ba.

♻️ This comment has been updated with latest results.

Move pattern building (whitespace, wildcard, safeCompile) and the
substring match-quality computation out of QuickAccessMatcher into a new
package-private QuickAccessMatching class with pure static methods.
QuickAccessMatcher delegates to the new helpers and keeps its
per-instance pattern cache. Behaviour is preserved.

Add a new JUnit 5 test, QuickAccessMatchingTest, that exercises the
extracted logic without a workbench harness: exact/prefix/substring
quality tiers, whitespace and wildcard pattern construction,
case-insensitivity, consecutive-star squashing, and the safeCompile
fallback for invalid regexes. Wire it into QuickAccessTestSuite.

Why this matters: the existing quick-access tests (ContentMatchesTest,
QuickAccessDialogTest) all open a real QuickAccessDialog, start a
workbench window, and poll results with DisplayHelper.waitForCondition
using 3000-5000 ms timeouts, on top of a one-time workbench-startup tax
for the whole tests bundle. Measured locally, the 12 new pure tests run
in 44 ms total (about 3.7 ms per test) via the JUnit console launcher.
Beyond the speedup, the new tests run in any plain JVM: no UI harness,
no Display, no X server, and no timing-based flakes. This makes it
practical to add broad coverage for matcher rules (ranking tiers,
wildcard edge cases, regex-compilation safety) that were previously
only covered indirectly through the dialog.
@vogella vogella force-pushed the refactor/quickaccess-pure-matching branch from ef3c5ed to c7fe4bb Compare April 20, 2026 15:02
@vogella vogella merged commit 67ae681 into eclipse-platform:master Apr 21, 2026
18 checks passed
@vogella vogella deleted the refactor/quickaccess-pure-matching branch April 21, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant