Extracting dynamic file path in Groovy script

114 Views Asked by At

I wanted to get the dynamic file path in Jmeter postprocessor script which write the variable value into that file. With local Jmeter run hardcoded path works fine, but wanted to share this with other teammates and as hardcoded path is not available on there system. getting an issue. I am new to groovy scripting, not sure about the exact solution, help is really appreciated.

Hardcoded path: C:/Users/xyz/Perf/src/test/jmeter/testdata.txt , wanted to get it dynamic as per the system it running the jmeter script. enter image description here

2

There are 2 best solutions below

0
SacTan On

Just tried this, it's working for me now with the 1st accepted solution. Access to JMeter script path

0
Guru On

You can use System.getProperty("user.dir") followed by file name.