Closed artemkurov closed 1 month ago
I think you are out of luck here. The listeners are initialized before any sampler has been run and I believe the filename is set on initialization.
I wonder though, why you took the route through the groovy function to get the property instead of using the P-function. It would not work in this case, either, but is seems more straightforward.
Things, that should work include:
Ok I understand now. Thank you for explanation. Issue could be closed now.
Expected behavior
${__groovy(props.get("baseDir")+"/results/latency_data.csv")}
evaluated to correct file path like/Users/username/projects/qa-perf/performance/jmeter/results/latency_data.csv
Actual behavior
${__groovy(props.get("baseDir")+"/results/latency_data.csv")}
evaluates tonull/results/latency_data.csv
Steps to reproduce the problem
Prerequisites:
Having a test plan (attached here bug.jmx.zip), containing:
init JSR223 Sampler having this code:
Simple Data Writer having this as a filename:
${__groovy(props.get("baseDir")+"/results/latency_data.csv")}
Tear down JSR223 Sampler having this code:
Reproducing
/Users/username/projects/qa-perf/performance/jmeter/results/latency_data.csv
file is created and no errors in the log/Users/username/projects/qa-perf/performance/jmeter
)jmeter -LINFO -n -j Buggy_Test_Plan.log -t bug.jmx -l Buggy_Test_Plan.jtl
/Users/username/projects/qa-perf/performance/jmeter/null/results/latency_data.csv
is createdINFO o.a.j.r.ResultCollector: Folder at /Users/username/projects/qa-perf/performance/jmeter/null/results was created
I assume that folder
null
is created because this happens before set of the variablebaseDir
, thusprops.get("baseDir")
returns null. But this flow does work through GUI mode, so should be a bug.JMeter Version
5.6.3
Java Version
openjdk 17.0.11 2024-04-16
OS Version
MacOS Sonoma 14.5 (also reproducable on Alpine Linux in Docker container)