Reputation: 111
I am trying to set up a maven project to run my existing script. I am passing a data file name(data.txt) from a csv setup using column data_file_name in input.csv file. In a HTTP POST, i am using below code to POST data.txt
${__eval(${__FileToString(C:/Jmeter/apache-jmeter-3.3/${__eval(${data_file_name})}.txt,,}
Now, i want to replace file path "C:/Jmeter/apache-jmeter-3.3" with maven project path. I have stored my jmeter script, csv file and data files under C:/Testing/Jmeter/src/test/jmeter folder. I went ahead and updated the above code like this
${__eval(${__FileToString(${__eval(${data_file_name})}.txt,,}
Basically, i want to run my script thru Jenkins and do not want to use a path which points to my machine. It should point to project workspace path. I get below warning when i use updated code
FileToString: Could not read open: data.txt
Not sure how to update path to use project src/jmeter path. Any help would be appreciacted. Thanks!
Upvotes: 1
Views: 2096
Reputation: 168207
I would recommend switching to other ways of executing JMeter test i.e.
Check out Five Ways To Launch a JMeter Test without Using the JMeter GUI article for more details on implementing above execution scenarios.
If you still want to use Maven you need to know that JMeter's working directory is target/jmeter/bin
while data files (i.e. your CSV file, your data.txt
file, etc) live under target/jmeter/testFiles
.
So you will need to amend your function to look like:
${__eval(${__FileToString(../testFiles/${data_file_name},,)})}
Upvotes: 0