artemkurov opened a new issue, #6323: URL: https://github.com/apache/jmeter/issues/6323
### 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 to `null/results/latency_data.csv` <img width="364" alt="image" src="https://github.com/user-attachments/assets/d8cd6668-606a-422b-9119-9153708fbcde"> ### Steps to reproduce the problem ### Prerequisites: Having a test plan (attached here [bug.jmx.zip](https://github.com/user-attachments/files/16459604/bug.jmx.zip)), containing: - setUp thread group, which contains --- init JSR223 Sampler - main thread group with --- Dummy sampler --- Simple Data Writer (or any listener) - tear down thread group with --- JSR223 Sampler init JSR223 Sampler having this code: ``` import org.apache.jmeter.util.JMeterUtils; import org.apache.jmeter.services.FileServer // Do not show this sampler in report SampleResult.setIgnore() // Set base directory. Mainly needed for local run String baseDir = FileServer.getFileServer().getBaseDir() JMeterUtils.setProperty("baseDir", baseDir) log.info("Base directory set to " + props.get('baseDir')) ``` Simple Data Writer having this as a filename: `${__groovy(props.get("baseDir")+"/results/latency_data.csv")}` Tear down JSR223 Sampler having this code: ``` // Do not show this sampler in report SampleResult.setIgnore() String filePath = props.get('baseDir') + '/results/latency_data.csv' log.info('filepath=' + filePath) File file = new File(filePath); if(!file.exists()) { log.error('FILE NOT FOUND') } // Pasre file //... ``` ### Reproducing 1. Run test plan from GUI. 2. Observe `/Users/username/projects/qa-perf/performance/jmeter/results/latency_data.csv` file is created and no errors in the log 3. Launch terminal in baseDir folder (for me is `/Users/username/projects/qa-perf/performance/jmeter`) 4. Launch the same test plan via CLI using command `jmeter -LINFO -n -j Buggy_Test_Plan.log -t bug.jmx -l Buggy_Test_Plan.jtl` 5. Observe unexpected behavior: - File `/Users/username/projects/qa-perf/performance/jmeter/null/results/latency_data.csv` is created - ERROR in logs because JSR223 sampler could not find the file. - `INFO 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 variable `baseDir`, thus `props.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) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@jmeter.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org