From 80cf5074fce1e7c45698a8552dfd4f63fcf48b3a Mon Sep 17 00:00:00 2001 From: waterWang Date: Fri, 21 Aug 2026 21:09:40 +0800 Subject: [PATCH] fix: correct 'Asserion.test_strings' typo in Response Assertion property name The Response Assertion stores its test strings under the misspelled property name 'Asserion.test_strings' (missing the letter 't') while every other property in the same class uses the 'Assertion.' prefix. This causes property name inconsistency and can lead to parsing issues or unexpected behavior when evaluating assertions, and the typo also leaks into saved .jmx test plans and the schematic XSL rendering. Fixes the constant, keeps backward compatibility by migrating the legacy misspelled property on read, and updates the schematic XSL. --- .../jmeter/assertions/ResponseAssertion.java | 17 +++++++++++++++-- .../org/apache/jmeter/gui/action/schematic.xsl | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/src/main/java/org/apache/jmeter/assertions/ResponseAssertion.java b/src/components/src/main/java/org/apache/jmeter/assertions/ResponseAssertion.java index f7df66aaa2f..269b881b117 100644 --- a/src/components/src/main/java/org/apache/jmeter/assertions/ResponseAssertion.java +++ b/src/components/src/main/java/org/apache/jmeter/assertions/ResponseAssertion.java @@ -64,7 +64,8 @@ public class ResponseAssertion extends AbstractScopedAssertion implements Serial private static final String REQUEST_HEADERS = "Assertion.request_headers"; // $NON-NLS-1$ private static final String REQUEST_DATA = "Assertion.request_data"; // $NON-NLS-1$ private static final String ASSUME_SUCCESS = "Assertion.assume_success"; // $NON-NLS-1$ - private static final String TEST_STRINGS = "Asserion.test_strings"; // $NON-NLS-1$ + private static final String TEST_STRINGS = "Assertion.test_strings"; // $NON-NLS-1$ + private static final String TEST_STRINGS_LEGACY = "Asserion.test_strings"; // $NON-NLS-1$ private static final String TEST_TYPE = "Assertion.test_type"; // $NON-NLS-1$ private static final String CUSTOM_MESSAGE = "Assertion.custom_message"; // $NON-NLS-1$ @@ -219,7 +220,19 @@ public int getTestType() { } public CollectionProperty getTestStrings() { - return (CollectionProperty) getProperty(TEST_STRINGS); + CollectionProperty result = (CollectionProperty) getProperty(TEST_STRINGS); + if (result instanceof NullProperty) { + CollectionProperty legacy = (CollectionProperty) getProperty(TEST_STRINGS_LEGACY); + if (legacy instanceof NullProperty) { + return new CollectionProperty(TEST_STRINGS, new ArrayList()); + } + // Migrate the legacy (misspelled) property so it is persisted under the correctly spelled name + CollectionProperty migrated = new CollectionProperty(TEST_STRINGS, legacy); + setProperty(migrated); + removeProperty(TEST_STRINGS_LEGACY); + return migrated; + } + return result; } public boolean isEqualsType() { diff --git a/src/core/src/main/resources/org/apache/jmeter/gui/action/schematic.xsl b/src/core/src/main/resources/org/apache/jmeter/gui/action/schematic.xsl index 8de641091d0..27abbc10f69 100644 --- a/src/core/src/main/resources/org/apache/jmeter/gui/action/schematic.xsl +++ b/src/core/src/main/resources/org/apache/jmeter/gui/action/schematic.xsl @@ -282,7 +282,7 @@ ul.tree li:last-child { [ - + "" ,