1
votes

I have a CSV Data Set Config,

enter image description here

I want to reference the variable Stack in my User Defined Variables and I have done it as follows,

I have used the __eval function to read the Stack variable

enter image description here

But in the request, I still see

https://${Stack}.testing.com

But I would like to see the value of the variable Stack from the CSV file.

I have tried the following,

__eval(${Stack}).testing.com  ->  ${Stack}.testing.com
__evalVar(Stack).testing.com  ->  .testing.com
${Stack}.testing.com          ->  ${Stack}.testing.com

Please advise on how can I reference the variable from CSV data set config in a User defined variable.

Thanks

2
Use just ${Stack} in your test plan. This will retrieve the value from the CSV. - NaveenKumar Namachivayam
I am able to retrieve the value from the CSV by using ${Stack}. - NaveenKumar Namachivayam
@NaveenKumarNamachivayam On using ${Stack} in User Defined Variable, I get ${Stack} I dont get the value of Stack. - LINGS
Can you post your jmeter.log info. - NaveenKumar Namachivayam
@NaveenKumarNamachivayam I reference a variable from CSV in UDV and I use that UDV in my requests. If I directly use the variable from CSV in my request that works as you said. - LINGS

2 Answers

2
votes

You won't be able to do it using CSV Data Set Config as it is getting initialised after User Defined Variables, however you should be able to use __CSVRead() function instead like:

${__CSVRead(users/login.csv,3)}.testing.com

Demo:

JMeter CSVRead in UDV

See How to Use JMeter Functions posts series for more information on the above and other JMeter functions.

0
votes

As per JMeter documentation, you cannot refer to variables it defines in the Test Plan - User defined variables.

Note that the Test Plan cannot refer to variables it defines.