JMeter - Can I combine 2 user variables into one?

James King picture James King · Aug 5, 2013 · Viewed 21.7k times · Source

I was wondering if you are able to combine two user variables into one. For example I have one user variable which is defined as the location of a root folder, and a second variable defined as a location from the root, down into a subfolder, and what I'm asking if its possible to put variable 1+variable 2 = a full path way?

so for example I have one variable as:

testData.directory = ${__P(testData.directory,C:\Users\MURPHYA1\Desktop\JMeter bodies)}
testData.testCases = ${__P(testData.testCases,\JMeter Basket body files)    

and what i want to produce is: C:\Users\MURPHYA1\Desktop\JMeter bodies\JMeter Basket body files

Is this possible?

UPDATE

I now have the following config and quite a few test variables just for testing: JMeter Config

Answer

Christopher Roscoe picture Christopher Roscoe · Aug 6, 2013

Add a second "User Defined Variables" element after yours. There every variable will be replaced by the values defined in your first element.

- User Defined Variables
- - test1 = a/
- - test2 = b
- User Defined Variables 2
- - test3 = ${test1}${test2}