You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Tong Sun <su...@gmail.com> on 2020/12/01 15:53:28 UTC
How to set system property within JMeter
Hi,
I need to set a system property programmatically *within* JMeter.
How can I do that?
in
https://www.blazemeter.com/blog/apache-jmeter-properties-customization
the Option 3 is to use JMeter __P, but
It seems that I can only read system property from __P(), but cannot
set it, correct?
thx
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: How to set system property within JMeter
Posted by Tong Sun <su...@gmail.com>.
Yes, thanks a lot!
Re: How to set system property within JMeter
Posted by "glinius@live.com" <gl...@live.com>.
If this is *really* what you need - go for __groovy() function
<https://jmeter.apache.org/usermanual/functions.html#__groovy> to call
System.setProperty() method
<https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#setProperty(java.lang.String,%20java.lang.String)>
like:
> ${__groovy(System.setProperty('foo'\,'bar'),)}
More information on Groovy scripting in JMeter: Apache Groovy - Why and How
You Should Use It <https://www.blazemeter.com/blog/groovy-new-black>
--
Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: How to set system property within JMeter
Posted by Tong Sun <su...@gmail.com>.
On Tue, Dec 1, 2020 at 11:21 AM glinius@live.com <gl...@live.com> wrote:
>
> You can set a JMeter Property via __setProperty() function
> <https://jmeter.apache.org/usermanual/functions.html#__setProperty> like:
>
>
> > ${__setProperty(foo,bar,)}
>
> will create a JMeter property "foo" with the value of "bar" which you can
> read using __P() function
> <https://jmeter.apache.org/usermanual/functions.html#__P> like
>
>
> > ${__P(foo,)}
>
> where required.
>
> More information: Knit One Pearl Two: How to Use Variables in Different
> Thread Groups
> <https://www.blazemeter.com/blog/knit-one-pearl-two-how-use-variables-different-thread-groups>
>
From https://www.blazemeter.com/blog/apache-jmeter-properties-customization,
There are 2 types of properties which are in use by Apache JMeter ...:
- System Properties
- JMeter Properties
I know one can set a *JMeter* Property via __setProperty() function,
but it is the "*System* Properties" that I was talking about.
I need to set a system property programmatically *within* JMeter.
thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: How to set system property within JMeter
Posted by "glinius@live.com" <gl...@live.com>.
You can set a JMeter Property via __setProperty() function
<https://jmeter.apache.org/usermanual/functions.html#__setProperty> like:
> ${__setProperty(foo,bar,)}
will create a JMeter property "foo" with the value of "bar" which you can
read using __P() function
<https://jmeter.apache.org/usermanual/functions.html#__P> like
> ${__P(foo,)}
where required.
More information: Knit One Pearl Two: How to Use Variables in Different
Thread Groups
<https://www.blazemeter.com/blog/knit-one-pearl-two-how-use-variables-different-thread-groups>
--
Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org