Reputation: 83
How can I declare a variable name by using the value of a property?
For example, I have the property propertyName
with the value propertyValue
. I want to declare a variable with the name propertyValue
.
I've tried like ${${__P(variableName)}}
but such constructions doesnt work.
Upvotes: 5
Views: 19066
Reputation: 15400
Property files are great!!! For my requirement, I have created a simple config element for JMeter to read property files.
Please check here.
http://www.testautomationguru.com/jmeter-property-file-reader-a-custom-config-element.
Upvotes: 1
Reputation: 7707
You may need to evaluate the property name, using the ${__V()}
function.
Thus, you'd probably end up with something like ${__V(${__P(propertyName)})}
which would only declare a variable with a null value.
Basics on properties & command line:
if you need to pass variables through the command line, properties are indeed the correct choice.
The flag to set a property is -JpropertyName
The function to read a property is ${__P(propertyName)}
For full details, see:
Upvotes: 10
Reputation: 2668
Give up using properties files, try using Variables From CSV plugin. It is pretty simple and robust way to have variables loaded from file.
Upvotes: 1