6

Is there any possibility to pass a value of user defined variable in another user defined variable? How to do this?


I've got a variable (name | value):

version | 5.6

and I want to use it in another one:

config | config_${version}.csv

enter image description here

It does not work because ${version} is treated as a string not as variable.

I've tried it with __eval function (the same) and with __P (then value of variable config was config1.csv, so ${version} was treated as a 1.


I'm using JMeter 3.3.

2 Answers 2

3

Notice the warning in User Defined Variables:

the variables are not available for use until after the element has been processed, so you cannot reference variables that are defined in the same element. You can reference variables defined in earlier UDVs or on the Test Plan.

So you can declare version variable to Test Plan and call it using __V function in User Defined Variables:

   ${__V(config_${version}.csv)}

Another option is to move to User Parameters with similar usage of __V function

For defining variables during a test run, see User Parameters. UDVs are processed in the order they appear in the Plan, from top to bottom.

Note: __P is used for retrieving JMeter property and not variable

Sign up to request clarification or add additional context in comments.

1 Comment

I think __V is not necessary when referring user variable declared in Test plan in user Defined variables node, just we can refer as config_${version}.csv
0

You can use jp@gc - Parameterized Controller for this.

Check the below snapshots

enter image description here

enter image description here

It;s up to you to use parameterized controller in place of UDV or combine them

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.