Discussion:
How to retrieve a jmeter property within Beanshell Preprocessor
Nirodha Pramod
2012-01-26 23:04:20 UTC
Permalink
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: ***@wso2.com Mobile: +94716429078
Deepak Shetty
2012-01-26 23:16:35 UTC
Permalink
the jmeter properties is passed as the props object to beanshell. You can
use that
Post by Nirodha Pramod
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/
Nirodha Pramod
2012-01-27 00:31:58 UTC
Permalink
Post by Deepak Shetty
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
Post by Deepak Shetty
Post by Nirodha Pramod
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
Post by Nirodha Pramod
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
Post by Nirodha Pramod
beanshell.
Thanks & regards,
Nirodha
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
Email: ***@wso2.com Mobile: +94716429078
Deepak Shetty
2012-01-27 00:33:42 UTC
Permalink
String value = props.getProperty("propertyName");
Post by Nirodha Pramod
Post by Deepak Shetty
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
Post by Deepak Shetty
Post by Nirodha Pramod
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
Post by Nirodha Pramod
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
Post by Nirodha Pramod
beanshell.
Thanks & regards,
Nirodha
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
Nirodha Pramod
2012-01-27 01:02:10 UTC
Permalink
Post by Deepak Shetty
String value = props.getProperty("propertyName");
Thanks a lot Deepak.
Post by Deepak Shetty
Post by Nirodha Pramod
Post by Deepak Shetty
the jmeter properties is passed as the props object to beanshell. You
can
Post by Nirodha Pramod
Post by Deepak Shetty
use that
Can you please explain with the syntax, since I'm a beginner for Jmeter.
Thanks,
Nirodha
Post by Deepak Shetty
Post by Nirodha Pramod
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
Post by Nirodha Pramod
to use in order to retrieve that property value inside beanshell PP.
I
Post by Nirodha Pramod
Post by Deepak Shetty
Post by Nirodha Pramod
tried vars.get("_property(csvread.filename)"); but it didn't work.
Can someone tell me the correct way to retrieve a property value
inside
Post by Nirodha Pramod
Post by Deepak Shetty
the
Post by Nirodha Pramod
beanshell.
Thanks & regards,
Nirodha
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
Email: ***@wso2.com Mobile: +94716429078
Tanakiat Srisaranayakul
2012-01-27 03:55:46 UTC
Permalink
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
Post by Nirodha Pramod
Post by Deepak Shetty
String value = props.getProperty("propertyName");
Thanks a lot Deepak.
Post by Deepak Shetty
Post by Nirodha Pramod
Post by Deepak Shetty
the jmeter properties is passed as the props object to beanshell. You
can
Post by Nirodha Pramod
Post by Deepak Shetty
use that
Can you please explain with the syntax, since I'm a beginner for
Jmeter.
Post by Deepak Shetty
Post by Nirodha Pramod
Thanks,
Nirodha
Post by Deepak Shetty
Post by Nirodha Pramod
Hi,
I'm running jmeter scripts via an ANT task. So I pass My own
property
Post by Deepak Shetty
Post by Nirodha Pramod
Post by Deepak Shetty
Post by Nirodha Pramod
called "csvread.filename" in that ANT task. But I could not find
the
Post by Deepak Shetty
Post by Nirodha Pramod
Post by Deepak Shetty
syntax
Post by Nirodha Pramod
to use in order to retrieve that property value inside beanshell
PP.
Post by Deepak Shetty
I
Post by Nirodha Pramod
Post by Deepak Shetty
Post by Nirodha Pramod
tried vars.get("_property(csvread.filename)"); but it didn't work.
Can someone tell me the correct way to retrieve a property value
inside
Post by Nirodha Pramod
Post by Deepak Shetty
the
Post by Nirodha Pramod
beanshell.
Thanks & regards,
Nirodha
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
sebb
2012-01-27 11:48:43 UTC
Permalink
Post by Tanakiat Srisaranayakul
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.
Post by Tanakiat Srisaranayakul
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.
Post by Tanakiat Srisaranayakul
Regards,
Tanakiat
Post by Nirodha Pramod
Post by Deepak Shetty
String value = props.getProperty("propertyName");
Thanks a lot Deepak.
Post by Deepak Shetty
Post by Nirodha Pramod
Post by Deepak Shetty
the jmeter properties is passed as the props object to beanshell. You
can
Post by Nirodha Pramod
Post by Deepak Shetty
use that
Can you please explain with the syntax, since I'm a beginner for
Jmeter.
Post by Deepak Shetty
Post by Nirodha Pramod
Thanks,
Nirodha
Post by Deepak Shetty
Post by Nirodha Pramod
Hi,
I'm running jmeter scripts via an ANT task. So I pass My own
property
Post by Deepak Shetty
Post by Nirodha Pramod
Post by Deepak Shetty
Post by Nirodha Pramod
called "csvread.filename" in that ANT task. But I could not find
the
Post by Deepak Shetty
Post by Nirodha Pramod
Post by Deepak Shetty
syntax
Post by Nirodha Pramod
to use in order to retrieve that property value inside beanshell
PP.
Post by Deepak Shetty
I
Post by Nirodha Pramod
Post by Deepak Shetty
Post by Nirodha Pramod
tried vars.get("_property(csvread.filename)"); but it didn't work.
Can someone tell me the correct way to retrieve a property value
inside
Post by Nirodha Pramod
Post by Deepak Shetty
the
Post by Nirodha Pramod
beanshell.
Thanks & regards,
Nirodha
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
Tanakiat Srisaranayakul
2012-01-28 14:20:20 UTC
Permalink
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,
Post by sebb
Post by Tanakiat Srisaranayakul
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.
Post by Tanakiat Srisaranayakul
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.
Post by Tanakiat Srisaranayakul
Regards,
Tanakiat
Post by Nirodha Pramod
Post by Deepak Shetty
String value = props.getProperty("propertyName");
Thanks a lot Deepak.
Post by Deepak Shetty
Post by Nirodha Pramod
Post by Deepak Shetty
the jmeter properties is passed as the props object to beanshell.
You
Post by Tanakiat Srisaranayakul
Post by Nirodha Pramod
Post by Deepak Shetty
can
Post by Nirodha Pramod
Post by Deepak Shetty
use that
Can you please explain with the syntax, since I'm a beginner for
Jmeter.
Post by Deepak Shetty
Post by Nirodha Pramod
Thanks,
Nirodha
Post by Deepak Shetty
Post by Nirodha Pramod
Hi,
I'm running jmeter scripts via an ANT task. So I pass My own
property
Post by Deepak Shetty
Post by Nirodha Pramod
Post by Deepak Shetty
Post by Nirodha Pramod
called "csvread.filename" in that ANT task. But I could not find
the
Post by Deepak Shetty
Post by Nirodha Pramod
Post by Deepak Shetty
syntax
Post by Nirodha Pramod
to use in order to retrieve that property value inside beanshell
PP.
Post by Deepak Shetty
I
Post by Nirodha Pramod
Post by Deepak Shetty
Post by Nirodha Pramod
tried vars.get("_property(csvread.filename)"); but it didn't
work.
Post by Tanakiat Srisaranayakul
Post by Nirodha Pramod
Post by Deepak Shetty
Post by Nirodha Pramod
Post by Deepak Shetty
Post by Nirodha Pramod
Can someone tell me the correct way to retrieve a property value
inside
Post by Nirodha Pramod
Post by Deepak Shetty
the
Post by Nirodha Pramod
beanshell.
Thanks & regards,
Nirodha
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
---------------------------------------------------------------------
sebb
2012-01-28 21:16:24 UTC
Permalink
Post by Tanakiat Srisaranayakul
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.
Post by Tanakiat Srisaranayakul
If so, I can make it right.
PS. Apologies for my English skill. I try my best :)
Thanks in advance,
Post by sebb
Post by Tanakiat Srisaranayakul
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.
Post by Tanakiat Srisaranayakul
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.
Post by Tanakiat Srisaranayakul
Regards,
Tanakiat
Post by Nirodha Pramod
Post by Deepak Shetty
String value = props.getProperty("propertyName");
Thanks a lot Deepak.
Post by Deepak Shetty
Post by Nirodha Pramod
Post by Deepak Shetty
the jmeter properties is passed as the props object to beanshell.
You
Post by Tanakiat Srisaranayakul
Post by Nirodha Pramod
Post by Deepak Shetty
can
Post by Nirodha Pramod
Post by Deepak Shetty
use that
Can you please explain with the syntax, since I'm a beginner for
Jmeter.
Post by Deepak Shetty
Post by Nirodha Pramod
Thanks,
Nirodha
Post by Deepak Shetty
Post by Nirodha Pramod
Hi,
I'm running jmeter scripts via an ANT task. So I pass My own
property
Post by Deepak Shetty
Post by Nirodha Pramod
Post by Deepak Shetty
Post by Nirodha Pramod
called "csvread.filename" in that ANT task. But I could not find
the
Post by Deepak Shetty
Post by Nirodha Pramod
Post by Deepak Shetty
syntax
Post by Nirodha Pramod
to use in order to retrieve that property value inside beanshell
PP.
Post by Deepak Shetty
I
Post by Nirodha Pramod
Post by Deepak Shetty
Post by Nirodha Pramod
tried vars.get("_property(csvread.filename)"); but it didn't
work.
Post by Tanakiat Srisaranayakul
Post by Nirodha Pramod
Post by Deepak Shetty
Post by Nirodha Pramod
Post by Deepak Shetty
Post by Nirodha Pramod
Can someone tell me the correct way to retrieve a property value
inside
Post by Nirodha Pramod
Post by Deepak Shetty
the
Post by Nirodha Pramod
beanshell.
Thanks & regards,
Nirodha
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
--
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
---------------------------------------------------------------------
Loading...