I understand that the CSV Data Set Config cannot use JMeter Variable as the "Filename", so I used the __property function as suggested in different posts:
This workaround runs fine when I run the mytest with the Jmeter GUI. As soon as I try to run the same test via cli (jmeter -n -t mytest,jmx -Jdatapool=c:\datapool), then it doesn't work anymore (ie: the csv data config is not able to find the csv file, since the property "pdatapoolpath" value is null. Please note, that in my BeanShell script I use to print the property's value, and still it seems to be correctly printed.
So my question is: where am I wrong? why jmeter behaves differently when run from GUI vs CLI?
thanks in advance
You can use variables in the CSV Data Set Config field If it can get initialized in the UDV.
Assuming there is a file in the name and in the path c:\datapool.csv
, by using -J
- you are actually passing a property
to the JMeter test ; not variable.
-J, --jmeterproperty {argument}={value} Define additional JMeter properties
If you invoke like this
jmeter -n -t mytest.jmx -Jdatapool=c:\datapool.csv
You can directly use this in the CSV Data Set Config by using the property name passed in the commandline.
${__P(datapool)}
If you need to copy this property to a User Defined Variable,
vdatapool = ${__P(datapool)}
then access the variables as given below in the CSV data set config.
${vdatapool}
This is how we need to access variables and properties in JMeter.
${variablename}
${__P(proprtyname)}