Skip to content

Save Response Assertion patterns under correctly spelled property name - #6758

Open
ashrafiucse wants to merge 1 commit into
apache:masterfrom
ashrafiucse:fix/jmeter-6289-assertion-property
Open

Save Response Assertion patterns under correctly spelled property name#6758
ashrafiucse wants to merge 1 commit into
apache:masterfrom
ashrafiucse:fix/jmeter-6289-assertion-property

Conversation

@ashrafiucse

Copy link
Copy Markdown

Description

Save the patterns of the Response Assertion under the correctly spelled property name Assertion.test_strings instead of the misspelled Asserion.test_strings.

For backward compatibility, the misspelled name is still accepted when a test plan is loaded: ResponseAssertion#setProperty migrates a Asserion.test_strings collection on the fly by renaming it, so test plans saved by JMeter versions up to and including 5.6.3 (and by the current trunk) keep working, and their patterns are re-saved under the correct name.

The schematic view (schematic.xsl) matches both property names, so schematic rendering of old test plans is unchanged. The test plans shipped with JMeter (bin/testfiles, bin/templates, bin/examples, extras) are renamed to the correct property name.

Motivation and Context

Fixes #6289

Every JMX file saved so far stores the assertion patterns under the misspelled property name:

<collectionProp name="Asserion.test_strings">

As noted on the issue, this also breaks interoperability with tooling that generates JMX files with the correct name (e.g. the OpenAPI generator): such assertions silently match nothing when loaded by JMeter, because JMeter looks up the misspelled property only.

How Has This Been Tested?

  • New tests in ResponseAssertionTest:
    • testPatternsAreStoredUnderCorrectPropertyName: patterns are stored under Assertion.test_strings
    • testPatternsSavedWithMisspelledPropertyNameAreMigrated: a Asserion.test_strings collection (as saved by JMeter ≤ 5.6.3) is migrated on setProperty, values preserved, legacy property gone
    • testPatternsAreAddedToMigratedValues: patterns added afterwards end up in the migrated collection
  • All 28 TestSaveService load/save round-trip tests pass after renaming the property in the shipped test plans
  • Full :src:components:test (552 tests) and :src:core:test (379 tests) suites pass
  • ./gradlew classes style passes
  • Verified end-to-end against a locally built distribution: a legacy demo JMX (xdocs/demos/AssertionTestPlan.jmx, still using the misspelled name) loads with its patterns intact, and newly saved JMX files contain Assertion.test_strings only

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. (release notes entry added to xdocs/changes.xml)

The patterns of the Response Assertion were saved under the misspelled
property name "Asserion.test_strings" (instead of
"Assertion.test_strings") by all JMeter versions up to and including
5.6.3.

Save the patterns under the correct name and migrate test plans saved
by older versions on load, so their patterns keep working. The
schematic view handles both property names, and the shipped test plans
are renamed to the correct property name.

Closes apache#6289
@ashrafiucse

Copy link
Copy Markdown
Author

Hi @vlsi — I saw your compatibility concern on #6753 and want to address it here before this PR goes the same way.

This PR reads both names (load-time migration in setProperty, so plans saved with Asserion.test_strings keep working), and unlike #6753 the schematic XSL matches both names so old plans still render. However I understand the remaining gap: files saved by this JMeter carry the new name only, so tools that hard-code the misspelled name when reading JMX (e.g. the MeterSphere extension you linked) would lose the patterns.

If the project prefers your middle ground — JMeter responding to two property names at the same time — I'm happy to rework this to also keep writing the legacy Asserion.test_strings collection alongside the correctly spelled one (kept in sync on every mutation), so old and new plugins/tools keep working. Just let me know which direction you'd like.

(Also noting #6751 is a duplicate of #6289 — this PR tracks #6289.)

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.

Bug: The name of a property of the AssertionGui control node is misspelled.

1 participant