1

Is it possible to call a user defined variable within another user defined variable? For example, in the screenshot below I would like to call the variable 'CmsVersion' value in 'ResultsPath'. Right now it is outputting ${CmsVersion} as the folder name and not the variable value.

User Defined Variables

2 Answers 2

5

You cannot, at least not within the bounds of a single User Defined Variables configuration element.

It is possible if you add another User Defined Variables below your original one, this way you will be able to reference the variables define in the above configuration element in the one(s) which is (are) below:

Demo:

enter image description here

More information: Using User Defined Variables

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

1 Comment

Thanks for the feedback!
2

Variables declared in the same User defined variables config element cannot be reused in the same element. You can move it to Test Plan level as per screenshot below Variable declared at test plan level

In your case you will need to do another special handling because you are dealing with a windows folder path. the \ is escape character in JAVA. When you say \${CmsVersion} JAVA is treating \$ as an escape sequence.

enter image description here

I have declared 2 variables CmsVersion correlated within the same config element and CmsVersion1 correlated from Test Plan variable.

Result is as below in Debug Sampler enter image description here

1 Comment

I like the idea of moving the variable to Test Plan level. Also, thanks for mentioning the pathing. Everything is working great, thanks!

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.