0
votes

I'm trying to get the directory of the test (.jmx file). I'm using this when running in GUI mode.

${__BeanShell(import org.apache.jmeter.gui.GuiPackage;GuiPackage.getInstance().getTestPlanFile();)}

This doesn't work when ran Jmeter is ran in non GUI mode. Is there any alternative to this?

1

1 Answers

1
votes

Most probably you're looking for FileServer.getBaseDir() function


Also be aware that since JMeter 3.1 it's recommended to switch to JSR223 Test Elements and Groovy language for scripting. The main reason is that Groovy is performing much better than Beanshell and others. If you want to use the JMeter Function - migrate to __groovv(), the relevant syntax would be:

${__groovy(org.apache.jmeter.services.FileServer.getFileServer().getBaseDir(),)}