2
votes

I want to know if there is a way to reference a file in the 'User Defined Variables" of the Test Plan relative to the install of Jmeter? For example instead of having a variable called 'sampleFile' and its value: C:\Jmeter\apache-jmeter-3.2\bin\example.txt I want to have a variable called 'sampleFile' and its value be relative to the install so: ..\bin\example.txt or ..\lib\example.txt. I am asking this because I want to place the script on a server.

Long story short: Can I make paths relative to the install of Jmeter? And if so how? Thanks!

2

2 Answers

1
votes

You can refer it using __P() function like:

${__P(user.dir,)}

See:

0
votes

It works.

 ${__javaScript(org.apache.jmeter.services.FileServer.getFileServer().getBaseDir())}/js/script.js 

See example