jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "BAZLEY, Sebastian" <sebastian.baz...@atosorigin.com>
Subject RE: BeanShell
Date Fri, 02 Jul 2004 13:09:12 GMT
>-----Original Message-----
>From: Jean-Denis Giguere [mailto:jdenisgiguere@fastmail.fm]
>Sent: 02 July 2004 13:52
>To: JMeter Users List
>Subject: BeanShell
>
>
>Hi list,
>
>I would like to use the __BeanShell function but I don't find 
>answers to 
>my questions in the jmeter doc. If someone use this function and can 
>answer my questions, it will be really appreciated.
>
>1. Which way can we pass the script in argument ? (Ralative path from 
>where we launch jmeter, relative path from jmeter bin, 
>absolute path or 
>you have to write directly the script as argument ?)

The script parameter is just that - a script, not a file containing a
script.

>2.Can we pass arguments to the script ?
>(ex. ${__BeanShell(myscript.bsh foo 13,answer)}

You can use function calls in the script paramater string.

>4. Can we pass the name of the script as a variable ?
>(ex. ${__BeanShell(${myScript},answer)}

See 1. The script does not have a "name". But you can pass a script in a
variable.

>
>3. The doc says that this function return the "result" of the script 
>passed in argument. How do you define the result of the script 
>? (Is it 
>the last variable assignation, the return of the main 
>function, the last 
>print ?)

See the BeanShell documentation for details, but IIRC, it will use the
return value or failing that the last assignment (it may even return the
last value).

>
>If someone has an exemple and would accept to share it (with the 
>function call and the result), it can help me very much.

${__BeanShell(return "abcd";)} -> abcd

${__BeanShell(return "${__threadNum()}";)} -> same as ${__threadNum()}

${__BeanShell(return Threads.currentThread().getName();)} should return the
current thread name

I think you can probably omit the return statement - try it and see.

Note that the current implementation is not as efficient as it could be -
the script is parsed anew each time, even if it has not been changed.

What do you want to use it for?

>
>Thank you for your attention,
>
>Jean-Denis Giguère
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>


___________________________________________________________________________

This e-mail and the documents attached are confidential and intended solely
for the addressee; it may also be privileged. If you receive this e-mail in
error, please notify the sender immediately and destroy it. As its integrity
cannot be secured on the Internet, the Atos Origin group liability cannot be
triggered for the message content. Although the sender endeavours to maintain
a computer virus-free network, the sender does not warrant that this
transmission is virus-free and will not be liable for any damages resulting
from any virus transmitted. 
___________________________________________________________________________


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


Mime
View raw message