Reputation: 11
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.
Upvotes: 1
Views: 647
Reputation: 350
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?
Upvotes: 0
Reputation: 168002
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.
Upvotes: 0