Skip to content

Fix duplicate menu entries and inconsistent Test Plan naming during merge. - #6768

Open
ruthst00 wants to merge 3 commits into
apache:masterfrom
ruthst00:fix/jmeter-6633-duplicate-menu-entries
Open

ruthst00 wants to merge 3 commits into
apache:masterfrom
ruthst00:fix/jmeter-6633-duplicate-menu-entries

Conversation

@ruthst00

@ruthst00 ruthst00 commented Sep 21, 2026

Copy link
Copy Markdown

Description

Both bugs from issue #6633 have been fixed across four files:

Bug 1 — Inconsistent Test Plan name after merge (3 files changed):

  • JMeterTreeModel.addSubTree() now has an overload that accepts a merging boolean. When merging=true, the userObject.setName(item.getName()) call is skipped, so the current plan's name is always preserved regardless of which node was selected at the time of the merge.
  • GuiPackage.addSubTree() gained a matching addSubTree(HashTree, boolean merging) overload that threads the flag down to the tree model.
  • Load.insertLoadedTree() now calls guiInstance.addSubTree(tree, merging) instead of the no-arg form, so the flag flows end-to-end from the user action all the way to the model.

Bug 2 — Duplicate Open / Merge / Save Selection As menu entries (1 file changed):

  • MenuFactory.addFileMenu() no longer adds Open, Merge, or Save Selection As items to the node popup / Edit menu. Those three are file-level actions that already live in the File menu bar; having them in the right-click popup (which is mirrored into the Edit menu) was the sole source of the duplication. A comment was added explaining the intentional omission.

Motivation and Context

Fixes #6633

There is inconsistent Test Plan naming and duplicate menu entries after merge:

  • If Test Plan node is selected: merged file contents are added, but the Test Plan name remains from the current plan (e.g., Test Plan A).
  • If a Thread Group node is selected: merged file contents are added, but the Test Plan name changes to the merged file’s name (e.g., Test Plan B).
  • Duplicate menu entries exist: File → Merge… and Edit → Merge…, File → Open… and Edit → Open…, File → Save Selection As… and Edit → Save Selection As….
  • These perform the same action, which may confuse users.

How Has This Been Tested?

Two new test files were added:

  • src/core/…/gui/tree/JMeterTreeModelMergeTest.java — 3 pure unit tests (no GUI required):
  • src/dist-check/…/gui/util/MenuFactoryFileMenuTest.java — 4 integration tests (placed in dist-check because MenuFactory's static initializer requires the full JMeter classpath)

Generated with Claude Sonnet via Cline

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.

… in JMeter 5.6.3.

Bug 1: Inconsistent Test Plan Name After Merge. When the loaded file's root element is a `TestPlan`, `addSubTree` always resets the current plan's name to the incoming plan's name.

Bug 2: Duplicate Menu Entries (Open, Merge, Save Selection As). `MenuFactory.addFileMenu()` is added to every node's popup, and that popup is mirrored into the Edit menu bar.

Menu entries should be consistent and non‑duplicated.
• File menu should contain file‑level actions.
• Edit menu should contain node‑level actions.
• Merge behavior should be predictable: either always preserve the current Test Plan name or always adopt the merged file’s name, regardless of selected node.

Closes apache#6633
… in JMeter 5.6.3.

Bug 1: Inconsistent Test Plan Name After Merge. When the loaded file's root element is a `TestPlan`, `addSubTree` always resets the current plan's name to the incoming plan's name.

Bug 2: Duplicate Menu Entries (Open, Merge, Save Selection As). `MenuFactory.addFileMenu()` is added to every node's popup, and that popup is mirrored into the Edit menu bar.

Menu entries should be consistent and non‑duplicated.
• File menu should contain file‑level actions.
• Edit menu should contain node‑level actions.
• Merge behavior should be predictable: either always preserve the current Test Plan name or always adopt the merged file’s name, regardless of selected node.

Closes apache#6633
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.

Duplicate menu entries and inconsistent Test Plan naming during merge in JMeter 5.6.3

1 participant