Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Declare Jmeter variable from a property value

Tags:

jmeter

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.

like image 581
Nikolay Avatar asked Sep 14 '11 07:09

Nikolay


1 Answers

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:

http://wiki.apache.org/jakarta-jmeter/JMeterFAQ#How_do_I_pass_parameters_into_my_Test_scripts.3F_I_want_to_be_able_to_use_the_same_script_to_test_with_different_numbers_of_threads_and_loops.2C_and_I_don.27t_want_to_have_to_change_the_script_each_time.

like image 147
BlackGaff Avatar answered Oct 10 '22 07:10

BlackGaff