You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Nirodha Pramod <ni...@wso2.com> on 2012/01/27 00:04:20 UTC

How to retrieve a jmeter property within Beanshell Preprocessor

Hi,

I'm running jmeter scripts via an ANT task. So I pass My own property
called "csvread.filename" in that ANT task. But I could not find the syntax
to use in order to retrieve that property value inside beanshell PP. I
tried vars.get("_property(csvread.filename)"); but it didn't work.

Can someone tell me the correct way to retrieve a property value inside the
beanshell.

Thanks & regards,
Nirodha

-- 
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
Email: nirodha@wso2.com   Mobile: +94716429078

Re: How to retrieve a jmeter property within Beanshell Preprocessor

Posted by sebb <se...@gmail.com>.
On 28 January 2012 14:20, Tanakiat Srisaranayakul <ta...@gmail.com> wrote:
> sebb,
>
> Thanks a lot for your reply. How is the performance related thing?
> Which one is the best to choose?
>
> I like the second way because it shows the value in Result Tree while I'm
> developing the script.
> However, I'd like to know there is a lot of impact on performance or not.

I doubt there will be much difference between the two methods, performance-wise.

> If so, I can make it right.
>
> PS. Apologies for my English skill. I try my best :)
>
> Thanks in advance,
>
> On Fri, Jan 27, 2012 at 6:48 PM, sebb <se...@gmail.com> wrote:
>
>> On 27 January 2012 03:55, Tanakiat Srisaranayakul <ta...@gmail.com>
>> wrote:
>> > Depak,
>> >
>> > This may be the different question but it's similar context.
>> >
>> > Which way is the best way to get the property/variable in beanshell?
>> >
>> > String value = props.getProperty("propertyName");
>>
>> That will be resolved by BeanShell itself.
>>
>> > or
>> >
>> > String value = "${__property(propertyName)}";
>>
>> That needs to be resolved by JMeter before the script is passed to
>> BeanShell, so is not suitable if the BeanShell script is in a file.
>>
>> > Regards,
>> > Tanakiat
>> >
>> > On Fri, Jan 27, 2012 at 8:02 AM, Nirodha Pramod <ni...@wso2.com>
>> wrote:
>> >
>> >> On Fri, Jan 27, 2012 at 6:03 AM, Deepak Shetty <sh...@gmail.com>
>> wrote:
>> >>
>> >> > String value = props.getProperty("propertyName");
>> >> >
>> >>
>> >> Thanks a lot Deepak.
>> >>
>> >> >
>> >> > On Thu, Jan 26, 2012 at 4:31 PM, Nirodha Pramod <ni...@wso2.com>
>> >> wrote:
>> >> >
>> >> > > On Fri, Jan 27, 2012 at 4:46 AM, Deepak Shetty <sh...@gmail.com>
>> >> > wrote:
>> >> > >
>> >> > > > the jmeter properties is passed as the props object to beanshell.
>> You
>> >> > can
>> >> > > > use that
>> >> > > >
>> >> > >
>> >> > > Can you please explain with the syntax, since I'm a beginner for
>> >> Jmeter.
>> >> > >
>> >> > > Thanks,
>> >> > > Nirodha
>> >> > >
>> >> > > >
>> >> > > > On Thu, Jan 26, 2012 at 3:04 PM, Nirodha Pramod <nirodha@wso2.com
>> >
>> >> > > wrote:
>> >> > > >
>> >> > > > > Hi,
>> >> > > > >
>> >> > > > > I'm running jmeter scripts via an ANT task. So I pass My own
>> >> property
>> >> > > > > called "csvread.filename" in that ANT task. But I could not find
>> >> the
>> >> > > > syntax
>> >> > > > > to use in order to retrieve that property value inside beanshell
>> >> PP.
>> >> > I
>> >> > > > > tried vars.get("_property(csvread.filename)"); but it didn't
>> work.
>> >> > > > >
>> >> > > > > Can someone tell me the correct way to retrieve a property value
>> >> > inside
>> >> > > > the
>> >> > > > > beanshell.
>> >> > > > >
>> >> > > > > Thanks & regards,
>> >> > > > > Nirodha
>> >> > > > >
>> >> > > > > --
>> >> > > > > *Nirodha Gallage*
>> >> > > > > Software Engineer, QA.
>> >> > > > > WSO2 Inc.: http://wso2.com/
>> >> > > > > Email: nirodha@wso2.com   Mobile: +94716429078
>> >> > > > >
>> >> > > >
>> >> > >
>> >> > >
>> >> > >
>> >> > > --
>> >> > > *Nirodha Gallage*
>> >> > > Software Engineer, QA.
>> >> > > WSO2 Inc.: http://wso2.com/
>> >> > > Email: nirodha@wso2.com   Mobile: +94716429078
>> >> > >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> *Nirodha Gallage*
>> >> Software Engineer, QA.
>> >> WSO2 Inc.: http://wso2.com/
>> >> Email: nirodha@wso2.com   Mobile: +94716429078
>> >>
>>
>> ---------------------------------------------------------------------
>> 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


Re: How to retrieve a jmeter property within Beanshell Preprocessor

Posted by Tanakiat Srisaranayakul <ta...@gmail.com>.
sebb,

Thanks a lot for your reply. How is the performance related thing?
Which one is the best to choose?

I like the second way because it shows the value in Result Tree while I'm
developing the script.
However, I'd like to know there is a lot of impact on performance or not.
If so, I can make it right.

PS. Apologies for my English skill. I try my best :)

Thanks in advance,

On Fri, Jan 27, 2012 at 6:48 PM, sebb <se...@gmail.com> wrote:

> On 27 January 2012 03:55, Tanakiat Srisaranayakul <ta...@gmail.com>
> wrote:
> > Depak,
> >
> > This may be the different question but it's similar context.
> >
> > Which way is the best way to get the property/variable in beanshell?
> >
> > String value = props.getProperty("propertyName");
>
> That will be resolved by BeanShell itself.
>
> > or
> >
> > String value = "${__property(propertyName)}";
>
> That needs to be resolved by JMeter before the script is passed to
> BeanShell, so is not suitable if the BeanShell script is in a file.
>
> > Regards,
> > Tanakiat
> >
> > On Fri, Jan 27, 2012 at 8:02 AM, Nirodha Pramod <ni...@wso2.com>
> wrote:
> >
> >> On Fri, Jan 27, 2012 at 6:03 AM, Deepak Shetty <sh...@gmail.com>
> wrote:
> >>
> >> > String value = props.getProperty("propertyName");
> >> >
> >>
> >> Thanks a lot Deepak.
> >>
> >> >
> >> > On Thu, Jan 26, 2012 at 4:31 PM, Nirodha Pramod <ni...@wso2.com>
> >> wrote:
> >> >
> >> > > On Fri, Jan 27, 2012 at 4:46 AM, Deepak Shetty <sh...@gmail.com>
> >> > wrote:
> >> > >
> >> > > > the jmeter properties is passed as the props object to beanshell.
> You
> >> > can
> >> > > > use that
> >> > > >
> >> > >
> >> > > Can you please explain with the syntax, since I'm a beginner for
> >> Jmeter.
> >> > >
> >> > > Thanks,
> >> > > Nirodha
> >> > >
> >> > > >
> >> > > > On Thu, Jan 26, 2012 at 3:04 PM, Nirodha Pramod <nirodha@wso2.com
> >
> >> > > wrote:
> >> > > >
> >> > > > > Hi,
> >> > > > >
> >> > > > > I'm running jmeter scripts via an ANT task. So I pass My own
> >> property
> >> > > > > called "csvread.filename" in that ANT task. But I could not find
> >> the
> >> > > > syntax
> >> > > > > to use in order to retrieve that property value inside beanshell
> >> PP.
> >> > I
> >> > > > > tried vars.get("_property(csvread.filename)"); but it didn't
> work.
> >> > > > >
> >> > > > > Can someone tell me the correct way to retrieve a property value
> >> > inside
> >> > > > the
> >> > > > > beanshell.
> >> > > > >
> >> > > > > Thanks & regards,
> >> > > > > Nirodha
> >> > > > >
> >> > > > > --
> >> > > > > *Nirodha Gallage*
> >> > > > > Software Engineer, QA.
> >> > > > > WSO2 Inc.: http://wso2.com/
> >> > > > > Email: nirodha@wso2.com   Mobile: +94716429078
> >> > > > >
> >> > > >
> >> > >
> >> > >
> >> > >
> >> > > --
> >> > > *Nirodha Gallage*
> >> > > Software Engineer, QA.
> >> > > WSO2 Inc.: http://wso2.com/
> >> > > Email: nirodha@wso2.com   Mobile: +94716429078
> >> > >
> >> >
> >>
> >>
> >>
> >> --
> >> *Nirodha Gallage*
> >> Software Engineer, QA.
> >> WSO2 Inc.: http://wso2.com/
> >> Email: nirodha@wso2.com   Mobile: +94716429078
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

Re: How to retrieve a jmeter property within Beanshell Preprocessor

Posted by sebb <se...@gmail.com>.
On 27 January 2012 03:55, Tanakiat Srisaranayakul <ta...@gmail.com> wrote:
> Depak,
>
> This may be the different question but it's similar context.
>
> Which way is the best way to get the property/variable in beanshell?
>
> String value = props.getProperty("propertyName");

That will be resolved by BeanShell itself.

> or
>
> String value = "${__property(propertyName)}";

That needs to be resolved by JMeter before the script is passed to
BeanShell, so is not suitable if the BeanShell script is in a file.

> Regards,
> Tanakiat
>
> On Fri, Jan 27, 2012 at 8:02 AM, Nirodha Pramod <ni...@wso2.com> wrote:
>
>> On Fri, Jan 27, 2012 at 6:03 AM, Deepak Shetty <sh...@gmail.com> wrote:
>>
>> > String value = props.getProperty("propertyName");
>> >
>>
>> Thanks a lot Deepak.
>>
>> >
>> > On Thu, Jan 26, 2012 at 4:31 PM, Nirodha Pramod <ni...@wso2.com>
>> wrote:
>> >
>> > > On Fri, Jan 27, 2012 at 4:46 AM, Deepak Shetty <sh...@gmail.com>
>> > wrote:
>> > >
>> > > > the jmeter properties is passed as the props object to beanshell. You
>> > can
>> > > > use that
>> > > >
>> > >
>> > > Can you please explain with the syntax, since I'm a beginner for
>> Jmeter.
>> > >
>> > > Thanks,
>> > > Nirodha
>> > >
>> > > >
>> > > > On Thu, Jan 26, 2012 at 3:04 PM, Nirodha Pramod <ni...@wso2.com>
>> > > wrote:
>> > > >
>> > > > > Hi,
>> > > > >
>> > > > > I'm running jmeter scripts via an ANT task. So I pass My own
>> property
>> > > > > called "csvread.filename" in that ANT task. But I could not find
>> the
>> > > > syntax
>> > > > > to use in order to retrieve that property value inside beanshell
>> PP.
>> > I
>> > > > > tried vars.get("_property(csvread.filename)"); but it didn't work.
>> > > > >
>> > > > > Can someone tell me the correct way to retrieve a property value
>> > inside
>> > > > the
>> > > > > beanshell.
>> > > > >
>> > > > > Thanks & regards,
>> > > > > Nirodha
>> > > > >
>> > > > > --
>> > > > > *Nirodha Gallage*
>> > > > > Software Engineer, QA.
>> > > > > WSO2 Inc.: http://wso2.com/
>> > > > > Email: nirodha@wso2.com   Mobile: +94716429078
>> > > > >
>> > > >
>> > >
>> > >
>> > >
>> > > --
>> > > *Nirodha Gallage*
>> > > Software Engineer, QA.
>> > > WSO2 Inc.: http://wso2.com/
>> > > Email: nirodha@wso2.com   Mobile: +94716429078
>> > >
>> >
>>
>>
>>
>> --
>> *Nirodha Gallage*
>> Software Engineer, QA.
>> WSO2 Inc.: http://wso2.com/
>> Email: nirodha@wso2.com   Mobile: +94716429078
>>

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


Re: How to retrieve a jmeter property within Beanshell Preprocessor

Posted by Tanakiat Srisaranayakul <ta...@gmail.com>.
Depak,

This may be the different question but it's similar context.

Which way is the best way to get the property/variable in beanshell?

String value = props.getProperty("propertyName");

or

String value = "${__property(propertyName)}";

Regards,
Tanakiat

On Fri, Jan 27, 2012 at 8:02 AM, Nirodha Pramod <ni...@wso2.com> wrote:

> On Fri, Jan 27, 2012 at 6:03 AM, Deepak Shetty <sh...@gmail.com> wrote:
>
> > String value = props.getProperty("propertyName");
> >
>
> Thanks a lot Deepak.
>
> >
> > On Thu, Jan 26, 2012 at 4:31 PM, Nirodha Pramod <ni...@wso2.com>
> wrote:
> >
> > > On Fri, Jan 27, 2012 at 4:46 AM, Deepak Shetty <sh...@gmail.com>
> > wrote:
> > >
> > > > the jmeter properties is passed as the props object to beanshell. You
> > can
> > > > use that
> > > >
> > >
> > > Can you please explain with the syntax, since I'm a beginner for
> Jmeter.
> > >
> > > Thanks,
> > > Nirodha
> > >
> > > >
> > > > On Thu, Jan 26, 2012 at 3:04 PM, Nirodha Pramod <ni...@wso2.com>
> > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I'm running jmeter scripts via an ANT task. So I pass My own
> property
> > > > > called "csvread.filename" in that ANT task. But I could not find
> the
> > > > syntax
> > > > > to use in order to retrieve that property value inside beanshell
> PP.
> > I
> > > > > tried vars.get("_property(csvread.filename)"); but it didn't work.
> > > > >
> > > > > Can someone tell me the correct way to retrieve a property value
> > inside
> > > > the
> > > > > beanshell.
> > > > >
> > > > > Thanks & regards,
> > > > > Nirodha
> > > > >
> > > > > --
> > > > > *Nirodha Gallage*
> > > > > Software Engineer, QA.
> > > > > WSO2 Inc.: http://wso2.com/
> > > > > Email: nirodha@wso2.com   Mobile: +94716429078
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > *Nirodha Gallage*
> > > Software Engineer, QA.
> > > WSO2 Inc.: http://wso2.com/
> > > Email: nirodha@wso2.com   Mobile: +94716429078
> > >
> >
>
>
>
> --
> *Nirodha Gallage*
> Software Engineer, QA.
> WSO2 Inc.: http://wso2.com/
> Email: nirodha@wso2.com   Mobile: +94716429078
>

Re: How to retrieve a jmeter property within Beanshell Preprocessor

Posted by Nirodha Pramod <ni...@wso2.com>.
On Fri, Jan 27, 2012 at 6:03 AM, Deepak Shetty <sh...@gmail.com> wrote:

> String value = props.getProperty("propertyName");
>

Thanks a lot Deepak.

>
> On Thu, Jan 26, 2012 at 4:31 PM, Nirodha Pramod <ni...@wso2.com> wrote:
>
> > On Fri, Jan 27, 2012 at 4:46 AM, Deepak Shetty <sh...@gmail.com>
> wrote:
> >
> > > the jmeter properties is passed as the props object to beanshell. You
> can
> > > use that
> > >
> >
> > Can you please explain with the syntax, since I'm a beginner for Jmeter.
> >
> > Thanks,
> > Nirodha
> >
> > >
> > > On Thu, Jan 26, 2012 at 3:04 PM, Nirodha Pramod <ni...@wso2.com>
> > wrote:
> > >
> > > > Hi,
> > > >
> > > > I'm running jmeter scripts via an ANT task. So I pass My own property
> > > > called "csvread.filename" in that ANT task. But I could not find the
> > > syntax
> > > > to use in order to retrieve that property value inside beanshell PP.
> I
> > > > tried vars.get("_property(csvread.filename)"); but it didn't work.
> > > >
> > > > Can someone tell me the correct way to retrieve a property value
> inside
> > > the
> > > > beanshell.
> > > >
> > > > Thanks & regards,
> > > > Nirodha
> > > >
> > > > --
> > > > *Nirodha Gallage*
> > > > Software Engineer, QA.
> > > > WSO2 Inc.: http://wso2.com/
> > > > Email: nirodha@wso2.com   Mobile: +94716429078
> > > >
> > >
> >
> >
> >
> > --
> > *Nirodha Gallage*
> > Software Engineer, QA.
> > WSO2 Inc.: http://wso2.com/
> > Email: nirodha@wso2.com   Mobile: +94716429078
> >
>



-- 
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
Email: nirodha@wso2.com   Mobile: +94716429078

Re: How to retrieve a jmeter property within Beanshell Preprocessor

Posted by Deepak Shetty <sh...@gmail.com>.
String value = props.getProperty("propertyName");

On Thu, Jan 26, 2012 at 4:31 PM, Nirodha Pramod <ni...@wso2.com> wrote:

> On Fri, Jan 27, 2012 at 4:46 AM, Deepak Shetty <sh...@gmail.com> wrote:
>
> > the jmeter properties is passed as the props object to beanshell. You can
> > use that
> >
>
> Can you please explain with the syntax, since I'm a beginner for Jmeter.
>
> Thanks,
> Nirodha
>
> >
> > On Thu, Jan 26, 2012 at 3:04 PM, Nirodha Pramod <ni...@wso2.com>
> wrote:
> >
> > > Hi,
> > >
> > > I'm running jmeter scripts via an ANT task. So I pass My own property
> > > called "csvread.filename" in that ANT task. But I could not find the
> > syntax
> > > to use in order to retrieve that property value inside beanshell PP. I
> > > tried vars.get("_property(csvread.filename)"); but it didn't work.
> > >
> > > Can someone tell me the correct way to retrieve a property value inside
> > the
> > > beanshell.
> > >
> > > Thanks & regards,
> > > Nirodha
> > >
> > > --
> > > *Nirodha Gallage*
> > > Software Engineer, QA.
> > > WSO2 Inc.: http://wso2.com/
> > > Email: nirodha@wso2.com   Mobile: +94716429078
> > >
> >
>
>
>
> --
> *Nirodha Gallage*
> Software Engineer, QA.
> WSO2 Inc.: http://wso2.com/
> Email: nirodha@wso2.com   Mobile: +94716429078
>

Re: How to retrieve a jmeter property within Beanshell Preprocessor

Posted by Nirodha Pramod <ni...@wso2.com>.
On Fri, Jan 27, 2012 at 4:46 AM, Deepak Shetty <sh...@gmail.com> wrote:

> the jmeter properties is passed as the props object to beanshell. You can
> use that
>

Can you please explain with the syntax, since I'm a beginner for Jmeter.

Thanks,
Nirodha

>
> On Thu, Jan 26, 2012 at 3:04 PM, Nirodha Pramod <ni...@wso2.com> wrote:
>
> > Hi,
> >
> > I'm running jmeter scripts via an ANT task. So I pass My own property
> > called "csvread.filename" in that ANT task. But I could not find the
> syntax
> > to use in order to retrieve that property value inside beanshell PP. I
> > tried vars.get("_property(csvread.filename)"); but it didn't work.
> >
> > Can someone tell me the correct way to retrieve a property value inside
> the
> > beanshell.
> >
> > Thanks & regards,
> > Nirodha
> >
> > --
> > *Nirodha Gallage*
> > Software Engineer, QA.
> > WSO2 Inc.: http://wso2.com/
> > Email: nirodha@wso2.com   Mobile: +94716429078
> >
>



-- 
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
Email: nirodha@wso2.com   Mobile: +94716429078

Re: How to retrieve a jmeter property within Beanshell Preprocessor

Posted by Deepak Shetty <sh...@gmail.com>.
the jmeter properties is passed as the props object to beanshell. You can
use that

On Thu, Jan 26, 2012 at 3:04 PM, Nirodha Pramod <ni...@wso2.com> wrote:

> Hi,
>
> I'm running jmeter scripts via an ANT task. So I pass My own property
> called "csvread.filename" in that ANT task. But I could not find the syntax
> to use in order to retrieve that property value inside beanshell PP. I
> tried vars.get("_property(csvread.filename)"); but it didn't work.
>
> Can someone tell me the correct way to retrieve a property value inside the
> beanshell.
>
> Thanks & regards,
> Nirodha
>
> --
> *Nirodha Gallage*
> Software Engineer, QA.
> WSO2 Inc.: http://wso2.com/
> Email: nirodha@wso2.com   Mobile: +94716429078
>