1

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?

Marek R
  • 32,568
  • 6
  • 55
  • 140

1 Answers1

2

Looking at BSFSampler code, FileName is relative to /bin.

So the way to to it :

  1. Add a User Defined Variables called scriptDir With value ${__P(scriptDir, dfltvalue)}

  2. Use it in your path as ${scriptDir}/

  3. 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