How to set system property within JMeter

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set system property within JMeter

Tong Sun
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to set system property within JMeter

glinius@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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to set system property within JMeter

Tong Sun
On Tue, Dec 1, 2020 at 11:21 AM [hidden email] <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to set system property within JMeter

glinius@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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to set system property within JMeter

Tong Sun
Yes, thanks a lot!