When I try to add input param in a non-GUI mode in JMeter, it adding an extra space at the end of the variable. There is no space when I enter the params but it is added to the API value when run.
-
Show how you send the parameter – Ori Marko Dec 18 '20 at 11:28
-
You could trim the value within your test plan – Janesh Kodikara Dec 18 '20 at 15:45
2 Answers
JMeter doesn't "add" or "remove" anything, if there is a "space" - then it's you who added it.
JMeter GUI doesn't show whitespaces so you can open the test plan with any text/XML editor of your choice (JMeter's JMX scripts are basically XML documents) and see if there is a blank space there.
If the variable comes from an external source (Post-Processor, CSV File or Database) you might want to check it at its source.

- 159,985
- 5
- 83
- 133
this is extremely painful to track-down, for the reasons given. I had a working JMX, but when clicking in the JMeter GUI, I accidentally appended a space at the end of a variable name; this is within the tabular "User Defined Variables" element. It slipped past me and, since JMeter does NOT trim that "Name:" field, my variable became "duration " instead of "duration". Downstream, since the TGs were expecting "${duration}" for "Duration (seconds)", the TG did not execute at all because the variable did not resolve to an integer value.
This seems to be a mistake in the JMeter design. Simply trimming the variable name, within the GUI commit, would have solved it for me.
What possible value is there to having trailing spaces in a variable name?

- 350
- 2
- 10