jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: setProperty doesn't work
Date Thu, 08 Nov 2012 11:08:27 GMT
On 8 November 2012 03:50, frank <hwl@windowslive.com> wrote:
> using jmeter 2.6, and i have 2 thread groups like next :
>
> -group1
>      |_request1
>              |_beanshell postprocessor1
>      |_request2
> -group2
>      |_request3
>              |_beanshell postprocessor2
>      |_request4
>
> beanshell postprocessor1 like next :
>
> ${__setProperty("rootObjectId", ${rootObjectId})};

Won't work - function references are resolved before BSH sees the script.

You need to use commands like

props.get("START.HMS");
props.put("PROP1","1234");

This is documented briefly here:

http://jmeter.apache.org/usermanual/component_reference.html#BeanShell_Sampler

> String s = "${bookingNo}";
> if(!s.equals("")){
>
> ${__setProperty(vari1,abc,)};
>
> }else{
>
> ${__setProperty(vari1,,)};
> }
>
> it'll execute 'else' statement
>
> and in request2 , it will use ${__property(vari1,,)} to get the property
> value, and the property value is empty.
>
> for beansehll processor2, its beanshell script is the same as beanshell
> processor1, but now it'll execute 'if' statement, that is i want to set
> value 'abc' for the property
>
> the problem is : in request4, ${__property(vari1,,)} still return empty
> string, but not abc.
>
> and the most confused is : if i add double quote for property name vari1,
> that is in group2, if i changed the beanshell script to :
>
> if(!s.equals("")){
>
> ${__setProperty("vari1",abc,)};
>
> }else{
>
> ${__setProperty("vari1",,)};
> }
>
> ${__property("vari1",,)}
>
> then it works, the ${__property("vari1",,)} of request4 will return abc.
>
> or if i add double quote for property vari1 in group1, but NOT add in
> group2, it also works, in request4, i can get the value abc.
>
> so what's the problem?
> Thanks in advance.
>
>
>
> --
> View this message in context: http://jmeter.512774.n5.nabble.com/setProperty-doesn-t-work-tp5715260.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Mime
View raw message