Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

groovy resources are not handled correctly #420

Open
vcnegru opened this issue Mar 25, 2022 · 4 comments
Open

groovy resources are not handled correctly #420

vcnegru opened this issue Mar 25, 2022 · 4 comments
Assignees
Labels
enhancement known workaround Known workaround for this issue
Milestone

Comments

@vcnegru
Copy link

vcnegru commented Mar 25, 2022

Config:
Java - 8.321
JMeter - 5.4.3
Maven - 3.6.3
JMeter-Maven-Plugin - 3.5.0

The case:
I use in jmx files - groovy scripts located at: ex. src/test/jmeter/scripts/example.groovy
The jmx is in src/test/jmeter/example.jmx and the script is refenced by path scripts/example.groovy

All folders/files are copied during execution to target/jmeter/testFiles.
But the script execution fails due to exception. Jmeter is looking for script at target/<uniq_id>/jmetre/bin :
2022-03-22 16:12:08,304 ERROR o.a.j.p.j.s.JSR223Sampler: Problem in JSR223 script Load Properties, message: javax.script.ScriptException: Script file 'C:\Users\*\IdeaProjects\performance_test\target\5009dd86-c21d-4a89-9293-1fad1ba2a7eb\jmeter\bin\..\scripts\example.groovy' does not exist or is unreadable for element:Load Properties javax.script.ScriptException: Script file 'C:\Users\*\IdeaProjects\performance_test\target\5009dd86-c21d-4a89-9293-1fad1ba2a7eb\jmeter\bin\..\scripts\example.groovy' does not exist or is unreadable for element:Load Properties at org.apache.jmeter.util.JSR223TestElement.processFileOrScript(JSR223TestElement.java:200) ~[ApacheJMeter_core-5.4.3.jar:5.4.3] at org.apache.jmeter.protocol.java.sampler.JSR223Sampler.sample(JSR223Sampler.java:72) [ApacheJMeter_java-5.4.3.jar:5.4.3] at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638) [ApacheJMeter_core-5.4.3.jar:5.4.3] at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558) [ApacheJMeter_core-5.4.3.jar:5.4.3] at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) [ApacheJMeter_core-5.4.3.jar:5.4.3] at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) [ApacheJMeter_core-5.4.3.jar:5.4.3] at java.lang.Thread.run(Thread.java:750) [?:1.8.0_321]

It's expected to handle all references to scripts from testFiles folder.

@Ardesco
Copy link
Contributor

Ardesco commented Mar 25, 2022

Can you provide an example project that reproduces the issue. It's probably the easiest way to make sure we don't miss any files.

@Ardesco Ardesco self-assigned this Mar 25, 2022
@vcnegru
Copy link
Author

vcnegru commented Mar 28, 2022

@Ardesco please check the sample project :https://github.com/vcnegru/jmeter-maven-plugin-example

@Ardesco
Copy link
Contributor

Ardesco commented Apr 4, 2022

By default JMeter uses the bin directory as its current working directory, changing that has repercussions and would probably cause more problems in the long run.

The most sensible fix would be to provide a test file directory property, so that you can refer to the test file directory in your scripts.

@Ardesco Ardesco added this to the 3.6.0 milestone Apr 4, 2022
@Ardesco Ardesco added the known workaround Known workaround for this issue label Apr 4, 2022
@Ardesco
Copy link
Contributor

Ardesco commented Apr 4, 2022

You can workaround this by using a relative path in your scripts which would be:

../../../../src/test/jmeter/scripts/example.groovy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement known workaround Known workaround for this issue
Projects
None yet
Development

No branches or pull requests

2 participants