-
Notifications
You must be signed in to change notification settings - Fork 27
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
Plugin is not passing "-D" args from Gradle to the JVM running Jmeter? #55
Comments
Can you try ref: http://jmeter.apache.org/usermanual/get-started.html#override |
Yes, I tried it. Gradle complains that "-J" is not a valid argument format. So, it needs to be in the form of "-D" arg evidently, from the point of view of Gradle (not Jmeter of course). |
From a quick look, it seems like a very small subset of system properties are picked up explicitly. That might need to change to pick up all system properties.
From here As a possible workaround, what happens if you add the following text to the file specified in jmeterUserProperties?
|
Yes, adding the props to a properties file does work but I didn't say that was a problem. I need to parameterize these tests from Jenkins, which requires system properties, preferrably passed as "-D" args. I'll have to keep using Maven until I figure this out. If I knew what format that env key-val pairs could be passed to 'jmeterUserProperties' then that would be a good workaround (by passing a -P arg and then have Gradle set the jmeterUserProperties variable) but the documentation on that is non-existent and my best guesses didn't work. Also, I couldn't find where the code even reads in that value, as if it were not ever implemented? |
I think I get what you're asking now - also saw your wiki edit. Sorry, I'm a bit slow today. The relevant code is here:
looks like it expects a List of strings, which are then added as
|
Thanks "foragerr". That worked as a great workaround. I'll update my Git project. It works now. I can't pass "-D" args but I sure can parse "-P" args and then set them on the 'jmeterUserProperties' variable. For example: |
Happy that works, but that is one ugly workaround. Definitely need to pick up all |
Yes, it's critical to get all the "-D" args because if you use Jenkins and if you want to parameterize the job, then using -P wont work. Parameterized builds pass only "-D" args. |
Did anything happen with this? I've got to pass JVM parameters to jmeter (to set up a keystore) and I see no way to pass them either by -D or in gradle |
Thanks foragerr, this workaround allows you to set jmeter properties but I need to pass properties to the underlying JVM (see http://jmeter.apache.org/usermanual/component_reference.html#Keystore_Configuration). I'm happy to use the other plugin and will raise an issue. Is this kulya plugin dead? |
What appears to me happening for me is that the jmeter-gradle-plugin is not passing "-D" args that were passed to Gradle on the command line to the JVM running Jmeter. I believe this should work since the 'maven-jmeter-plugin' has this behavior. It appears that this jmeter-gradle-plugin is somehow filtering out the args? I created an example project which I think demonstrates this problem.
https://github.com/djangofan/JmeterExample-withGradle
In this project I run with this command:
gradlew.bat printBuildScriptClasspath jmeterCleanReport jmeterRun -Penv=dev -DuserThreads=2 -DrampupSeconds=10 -DthreadLoops=1 -DtestInt=999 -DtestString=BlahBlah
And I am expecting to look at the report and see a 'testInt' value of '999' but if you run this project yourself, you will see that the system property does not seem to pass through to Jmeter at all and it assumes a default value instead.
If the intention was to only allow '-P' args and then forward them to the Jmeter process via the 'jmeterUserProperties' argument, I could accept that but I DO NOT know the format of what the key-val args need to look like when passed as 'jmeterUserProperties' .
The text was updated successfully, but these errors were encountered: