jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Schumacher <felix.schumac...@internetallee.de>
Subject Re: Issue with javascript math function in Jmeter 3.3
Date Mon, 15 Jan 2018 10:07:52 GMT


Am 15. Januar 2018 10:19:13 MEZ schrieb sebb <sebbaz@gmail.com>:
>On 15 January 2018 at 07:29, Felix Schumacher
><felix.schumacher@internetallee.de> wrote:
>>
>>
>> Am 13. Januar 2018 22:32:01 MEZ schrieb Marcelo Jara
><marcelojara@hotmail.com>:
>>>Hello,
>>>
>>>
>>>I'm running into an issue with Jmeter 3.3. It seems the Math.floor()
>>>Javascript function is behaving differently when compared to older
>>>versions such as 2.12. I've simplified the call below for this email.
>>>
>>>
>>>${__intSum(${__javaScript(Math.floor(${667}/60))},${extra},)}
>
>${667} means to use the value of the variable called '667'
>
>Is that what you really meant?

I supposed that this 667 was left by the simplification and used the value directly in my
tests. 

Result seems to be the same. 

Nashorn will give back a double and rhino an int. 

Funny enough if I log the result of Math.floor inside a Javascript jsr223 sampler it logs
an int value. 

Another hack to get an int value inside of __javaScript is using

__javaScript("" +Math.floor(...))

Felix

>
>>>
>>>
>>>
>>>667/60 = 11.1166    so the Math.floor function should return 11.
>>>Instead it's returning the exception below. It seems Math.floor is
>not
>>>evaluating to an Int.
>>
>> Try to set the property javascript.use_rhino to true.
>>
>> And file a Bugzilla entry as this seems to be a regression we should
>look at.
>>
>> Regards,
>>  Felix
>>
>>>
>>>
>>>2018-01-13 16:23:12,808 ERROR o.a.j.JMeter: Uncaught exception:
>>>java.lang.NumberFormatException: For input string: "11.0"
>>>at
>>>java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
>>>~[?:1.8.0_152]
>>>        at java.lang.Integer.parseInt(Integer.java:580)
>~[?:1.8.0_152]
>>>        at java.lang.Integer.parseInt(Integer.java:615)
>~[?:1.8.0_152]
>>>at org.apache.jmeter.functions.IntSum.execute(IntSum.java:67)
>>>~[ApacheJMeter_functions.jar:3.3 r1808647]
>>>at
>>>org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:137)
>>>~[ApacheJMeter_core.jar:3.3 r1808647]
>>>at
>>>org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:112)
>>>~[ApacheJMeter_core.jar:3.3 r1808647]
>>>at
>>>org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:101)
>>>~[ApacheJMeter_core.jar:3.3 r1808647]
>>>at
>>>org.apache.jmeter.testelement.property.AbstractProperty.getIntValue(AbstractProperty.java:108)
>>>~[ApacheJMeter_core.jar:3.3 r1808647]
>>>at
>>>org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsInt(AbstractTestElement.java:238)
>>>~[ApacheJMeter_core.jar:3.3 r1808647]
>>>at
>>>org.apache.jmeter.threads.AbstractThreadGroup.getNumThreads(AbstractThreadGroup.java:209)
>>>~[ApacheJMeter_core.jar:3.3 r1808647]
>>>at
>>>org.apache.jmeter.engine.StandardJMeterEngine.startThreadGroup(StandardJMeterEngine.java:509)
>>>~[ApacheJMeter_core.jar:3.3 r1808647]
>>>at
>>>org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:457)
>>>~[ApacheJMeter_core.jar:3.3 r1808647]
>>>        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_152]
>>>
>>>
>>>
>>>
>>>Any suggestions?
>>
>> ---------------------------------------------------------------------
>> 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

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


Mime
View raw message