Skip to content

Add tests for find/replace UI history store and overlay#4000

Open
HeikoKlare wants to merge 1 commit into
eclipse-platform:masterfrom
HeikoKlare:add-find-replace-history-tests
Open

Add tests for find/replace UI history store and overlay#4000
HeikoKlare wants to merge 1 commit into
eclipse-platform:masterfrom
HeikoKlare:add-find-replace-history-tests

Conversation

@HeikoKlare
Copy link
Copy Markdown
Contributor

@HeikoKlare HeikoKlare commented May 14, 2026

Motivation

The history feature of the find/replace UI lacked test coverage, as documented in #2100.

Changes

HistoryStoreTest — unit tests for HistoryStore

HistoryStore carries non-trivial logic (newest-first ordering, in-place deduplication, size-limit enforcement, IDialogSettings persistence) that warrants direct unit testing. Without these, failures in this layer would only surface as hard-to-diagnose UI test failures.

Integration tests for history storage behaviour

Unit tests cannot detect wiring mistakes such as a missing storeHistory() call in an action handler. New integration tests in FindReplaceUITest verify that search terms are correctly persisted after search and replace operations, and that history ordering and deduplication work end-to-end. Running them in the common superclass ensures both the overlay and the dialog are covered.

IFindReplaceUIAccess gains selectFindHistoryEntry(int index) to abstract over the two navigation mechanisms: ARROW_DOWN simulation in the overlay text field, and programmatic combo selection in the dialog.

Two overlay-specific tests remain in FindReplaceOverlayTest to cover the directional search buttons, which have no dialog counterpart.

Notes

This PR was created with the help of Claude Code.

The history feature of the find/replace UI lacks test coverage in two
distinct areas:

HistoryStore (unit tests): HistoryStoreTest covers the storage class in
isolation — ordering (newest-first), deduplication, size-limit
enforcement, remove semantics, persistence across instances sharing the
same IDialogSettings, and independence of separate sections. Unit tests
are necessary here because the class carries non-trivial logic (e.g. the
in-place deduplication loop in write()) that should be verified without
spinning up the Eclipse workbench, and because failures in this layer
would otherwise only surface as hard-to-diagnose UI test failures.

Find/replace UI (integration tests): five new tests in FindReplaceUITest
verify that history is correctly populated after search, replace-all,
and
single replace, and that entries are ordered newest-first with
duplicates
suppressed. Running them in the common superclass ensures both the
overlay
and the dialog are covered. IFindReplaceUIAccess gains
selectFindHistoryEntry(int)
to abstract over the two different navigation mechanisms (ARROW_DOWN in
the overlay text field, combo selection in the dialog). Two additional
tests remain in FindReplaceOverlayTest to cover the overlay-specific
forward and backward search buttons, which have no dialog counterpart.

Fixes eclipse-platform#2100
@HeikoKlare HeikoKlare force-pushed the add-find-replace-history-tests branch from b81b360 to 0548bfe Compare May 14, 2026 08:33
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

Test Results

   867 files  ± 0     867 suites  ±0   57m 51s ⏱️ - 3m 56s
 8 017 tests +29   7 774 ✅ +29  243 💤 ±0  0 ❌ ±0 
20 538 runs  +72  19 883 ✅ +72  655 💤 ±0  0 ❌ ±0 

Results for commit 0548bfe. ± Comparison against base commit b58e3b4.

♻️ This comment has been updated with latest results.

@HeikoKlare HeikoKlare marked this pull request as ready for review May 14, 2026 12:00
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