You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Ra...@alcatel.fr on 2005/06/28 16:59:43 UTC

unable to use beanshell

Hi all,

i have to work with dates so i thought i could use beanshell so that i 
can use java with makes it very easy to handle date formats.
i've read some previous posts about dates but i must be missing 
something as i can't make it work.
here's what i've done :
i've downloaded the bsh-2.0b4.jar and put it in jmeter/lib.
i've create a user defined variable called TODAY
with the value
${__BeanShell(java.util.GregorianCalendar calendar = new 
java.util.GregorianCalendar();Date date = calendar.getTime();new 
java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(date))}
and i try to use ${TODAY} as a parameter value in my request.
when a use a view tree result to see the request, i see that the code is 
written as it is
(${__BeanShel......)
and is not evaluated.
i've also tried using the javascript function __javascript i get the 
same thing in the request : the value of my user defined variable is 
written instead of its value.

any ideas ?

Thanks in advance,
raj




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


Re: unable to use beanshell

Posted by Ra...@alcatel.fr.
Hi Josh,

Thanks for the very quick answer.

it's working !!

thank you very much !

Raj



Joshua Auerbach a écrit :

> User defined variables must be static...just use the Beanshell 
> function where you are currently using the ${TODAY} variable
>
> -Josh
>
>
> Raj.Mulji_Solanski@alcatel.fr wrote:
>
>> Hi all,
>>
>> i have to work with dates so i thought i could use beanshell so that 
>> i can use java with makes it very easy to handle date formats.
>> i've read some previous posts about dates but i must be missing 
>> something as i can't make it work.
>> here's what i've done :
>> i've downloaded the bsh-2.0b4.jar and put it in jmeter/lib.
>> i've create a user defined variable called TODAY
>> with the value
>> ${__BeanShell(java.util.GregorianCalendar calendar = new 
>> java.util.GregorianCalendar();Date date = calendar.getTime();new 
>> java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(date))}
>> and i try to use ${TODAY} as a parameter value in my request.
>> when a use a view tree result to see the request, i see that the code 
>> is written as it is
>> (${__BeanShel......)
>> and is not evaluated.
>> i've also tried using the javascript function __javascript i get the 
>> same thing in the request : the value of my user defined variable is 
>> written instead of its value.
>>
>> any ideas ?
>>
>> Thanks in advance,
>> raj
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

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


Re: unable to use beanshell

Posted by Joshua Auerbach <jo...@dealer.com>.
User defined variables must be static...just use the Beanshell function 
where you are currently using the ${TODAY} variable

-Josh


Raj.Mulji_Solanski@alcatel.fr wrote:

> Hi all,
>
> i have to work with dates so i thought i could use beanshell so that i 
> can use java with makes it very easy to handle date formats.
> i've read some previous posts about dates but i must be missing 
> something as i can't make it work.
> here's what i've done :
> i've downloaded the bsh-2.0b4.jar and put it in jmeter/lib.
> i've create a user defined variable called TODAY
> with the value
> ${__BeanShell(java.util.GregorianCalendar calendar = new 
> java.util.GregorianCalendar();Date date = calendar.getTime();new 
> java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(date))}
> and i try to use ${TODAY} as a parameter value in my request.
> when a use a view tree result to see the request, i see that the code 
> is written as it is
> (${__BeanShel......)
> and is not evaluated.
> i've also tried using the javascript function __javascript i get the 
> same thing in the request : the value of my user defined variable is 
> written instead of its value.
>
> any ideas ?
>
> Thanks in advance,
> raj
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>


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