Skip to content

Preserve Test Fragment name when saving - #6934

Merged
milamberspace merged 2 commits into
apache:masterfrom
orimarko:issue-6170-preserve-test-fragment-name
Dec 5, 2026
Merged

milamberspace merged 2 commits into
apache:masterfrom
orimarko:issue-6170-preserve-test-fragment-name

Conversation

@orimarko

@orimarko orimarko commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

Saving a Test Fragment now retains its existing name in the open plan and in the exported .jmx file. The save operation also avoids clearing the cached fragment editor while constructing the export.

Motivation and Context

Fixes #6170. Previously, saving a renamed Test Fragment could reset its UI name to Test Fragment.

How Has This Been Tested?

  • .\gradlew.bat --quiet :src:components:test --tests org.apache.jmeter.gui.action.TestSave classes style - passed.
  • Checked manually using runGui save and reload test fragements

Screenshots (if appropriate):

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.

@orimarko
orimarko force-pushed the issue-6170-preserve-test-fragment-name branch from 2482bf9 to ad9ab43 Compare December 5, 2026 09:13

@milamberspace milamberspace left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The root cause checks out: GuiPackage.createTestElement() reuses the cached TestFragmentControllerGui, the very instance showing the selected fragment, and calls clearGui() on it, so the next GUI-to-element update wrote the default name back into the tree. Building the exported root from a throwaway TestFragmentControllerGui avoids touching the cached editor, flushing pending edits with updateCurrentNode() first is right, and carrying the fragment's name over to the exported root is a nice touch.

A couple of things before this can go in:

  1. AI attribution: ASF does not list AI tools as co-authors. Please replace the Co-authored-by: Copilot <…> trailer in the commit message with a Generated-by: trailer, for example Generated-by: GitHub Copilot. See the ASF Generative Tooling guidance.
  2. xdocs/changes.xml: please add an entry under Bug fixes › General, for example <li><pr>6934</pr><issue>6170</issue>Keep the name of a Test Fragment when saving it with <code>Save as Test Fragment</code>.</li>, with a "Contributed by" credit and a matching line in the Thanks section.

Minor, non-blocking: the new tests cover setTestFragmentName only; the clearGui() side effect is GUI-bound, so the manual check is fine.


This review was drafted by an AI-assisted tool and
confirmed by an Apache JMeter maintainer. After you've
addressed the points above and pushed an update, an Apache JMeter
maintainer — a real person — will take the next look
at the PR. The findings cite the project's review criteria;
if you think one of them is mis-applied, please reply on the
PR and a maintainer will weigh in.

More on how Apache JMeter handles maintainer review:
Contributing guide.

Fixes apache#6170

Generated-by: GitHub Copilot
@orimarko
orimarko force-pushed the issue-6170-preserve-test-fragment-name branch from ad9ab43 to da68fba Compare December 5, 2026 14:23

@milamberspace milamberspace left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick update! Both points are addressed: the commit now carries a Generated-by: trailer, and changes.xml has the entry and the credit. CI is green. I'll adjust the credit to your full name on master after merging.


This review was drafted by an AI-assisted tool and
confirmed by an Apache JMeter maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.

More on how Apache JMeter handles maintainer review:
Contributing guide.

@milamberspace
milamberspace merged commit 9abc899 into apache:master Dec 5, 2026
7 checks passed
milamberspace added a commit that referenced this pull request Dec 5, 2026
Generated-by: Claude Code 2.1.337 (Claude Opus 5.5)
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.

Saving test fragment renames the test fragment

2 participants