Add tests for find/replace UI history store and overlay#4000
Open
HeikoKlare wants to merge 1 commit into
Open
Conversation
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
b81b360 to
0548bfe
Compare
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The history feature of the find/replace UI lacked test coverage, as documented in #2100.
Changes
HistoryStoreTest— unit tests forHistoryStoreHistoryStorecarries non-trivial logic (newest-first ordering, in-place deduplication, size-limit enforcement,IDialogSettingspersistence) 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 inFindReplaceUITestverify 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.IFindReplaceUIAccessgainsselectFindHistoryEntry(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
FindReplaceOverlayTestto cover the directional search buttons, which have no dialog counterpart.Notes
This PR was created with the help of Claude Code.