I need to have script relative file name (relative to test plan file) in BFS Prepocessor in JMeter. I need something like: "../scripts/commonscript.js" but this doesn't work, I have to use the whole path and this is very bad for version control.
Is there some variable/property/function so I can use path relative to test plan file?
Asked
Active
Viewed 1,076 times
1

Marek R
- 32,568
- 6
- 55
- 140
-
What do you mean by "doesn't work"? I think path will be relative to ApacheJmeter.jar that is in /bin folder – Andrei Botalov Dec 01 '12 at 22:01
-
yes but I need path to be relative to test plan file (*.jmx)! Not to JMeter location. IMO this is more natural. – Marek R Dec 01 '12 at 22:05
-
Maybe but that's not the contract :-) , I updated my answer – UBIK LOAD PACK Dec 02 '12 at 13:03
1 Answers
2
Looking at BSFSampler code, FileName is relative to /bin.
So the way to to it :
Add a User Defined Variables called scriptDir With value ${__P(scriptDir, dfltvalue)}
Use it in your path as ${scriptDir}/
Define this variable at startup using -JscriptDir=

UBIK LOAD PACK
- 33,980
- 5
- 71
- 116
-
This post has a similar answer but I believe it to be more useable: http://stackoverflow.com/questions/16785597/jmeter-upload-file-with-relative-path-from-the-jmx-file – theINtoy Oct 31 '13 at 10:51
-
No the solution described elsewhere uselessly makes usage of Beanshell. Solution here only uses standard function so it will be more maintainable and more performing – UBIK LOAD PACK Oct 31 '13 at 13:38