jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DjinnS <dji...@chninkel.net>
Subject Re: JavaScript function
Date Fri, 13 May 2011 13:25:49 GMT
Le 13/05/2011 15:13, sebb a écrit :
> On 13 May 2011 13:55, DjinnS<djinns@chninkel.net>  wrote:
>> Le 13/05/2011 13:53, sebb a écrit :
>>> On 13 May 2011 12:39, DjinnS<djinns@chninkel.net>    wrote:
>>>> Bonjour,
>>>>
>>>> I'm going crazy ! I can't used $__JavaScript{} to get a ratio.
>>>>
>>>> I try to use the following code (in a "User Defined Variable"):
>>>>
>>>> ${__JavaScript(Math.round(10*50/100))}
>>> There is no such function as __JavaScript.
>>>
>>>> (in fact, "10" is also a value from an another "User Defined Variable")
>>>>
>>>> This code don't work.
>>>>
>>>> If I try a very simple math operation, like this:
>>>>
>>>> ${__JavaScript(1+1)}
>>>>
>>>> It's ok !
>>> No, that fails for the same reason.
>>>
>>> See:
>>>
>>> http://jakarta.apache.org/jmeter/usermanual/functions.html#__javaScript
>>>
>>>> What's going wrong with my first code ?
>>> _Both_ are spelt incorrectly.
>> Yes, there is a mistake in my email.
>>
>> So, with the correct spelt, my function is:
>>
>> ${__javaScript(Math.round(${var}*50/100),total)}
>>
>> It isn't working.
> Works for me, provided that I define the "var" variable.
>
> What makes you think it is not working?
> What are you expecting, what are you getting?
>
Felix,

Yes, :/ , it's an another ctrl-c/ctrl-v mistake. I use this code in jmeter:

${__javaScript(Math.round(${var}*50/100))}

Seb,

I try to get working threads with variables. I have 4 threads groups and 
I want to run many tests with a differents number of simulated users. I 
divide the number of user with a ratio in order to simulate a "real" 
traffic.

In the end, the result of the javascript execution is stored in a 
variable used in one on my threads groups.

It's ok if I replace ${var} with an integer. Obviously, var is defined 
before.


---------------------------------------------------------------------
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