jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael P. McDonnell" <bzaks1...@gmail.com>
Subject Exception When using the Javascript Function
Date Thu, 02 Apr 2009 21:19:18 GMT
When utilizing the Javascript function in Jmeter 2.3.2 (r665936):

I have a Thread Group set up as follows:

WebService (SOAP) Request
     -XPath Assertion
     -Counter
Constant Throughput Timer

First of all I would like to note that the WebService Sampler rocks. Thank
you for making it. The counter + the assertion are also great.

The constant throughput timer USUALLY works very well.

However today I decided I was going to see if I could adjust my test by
passing one new variable from the command line, so I needed to do some
calculations within Jmeter.
I set the target throughput to:

${__javaScript(${VARONE}*${VARTWO}/${VARTHREE})}

Values of Variables:
VARONE = 146.17 (which is set in the "User Defined Variables" for the test
plan)
VARTWO = 1000 (which is currently set in the "User Defined Variables" for
the test plan but will eventually be passed in)
VARTHREE = ${__javaScript(16*60)} (which is set in the "User Defined
Variables" for the test plan)

When I start the test, only one sample goes through and then nothing until I
try to stop the test. At this point, I get this exception:

Exception in thread "Thread-77" org.mozilla.javascript.EvaluatorException:
missing ; before statement (<cmd>#1)
        at
org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:98)
        at
org.mozilla.javascript.DefaultErrorReporter.error(DefaultErrorReporter.java:85)
        at org.mozilla.javascript.Parser.addError(Parser.java:126)
        at org.mozilla.javascript.Parser.reportError(Parser.java:132)
        at org.mozilla.javascript.Parser.statementHelper(Parser.java:1175)
        at org.mozilla.javascript.Parser.statement(Parser.java:623)
        at org.mozilla.javascript.Parser.parse(Parser.java:355)
        at org.mozilla.javascript.Parser.parse(Parser.java:293)
        at org.mozilla.javascript.Context.compileImpl(Context.java:2238)
        at org.mozilla.javascript.Context.compileString(Context.java:1284)
        at org.mozilla.javascript.Context.compileString(Context.java:1273)
        at org.mozilla.javascript.Context.evaluateString(Context.java:1129)
        at
org.apache.jmeter.functions.JavaScript.execute(JavaScript.java:94)
        at
org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:138)
        at
org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:107)
        at
org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:78)
        at
org.apache.jmeter.testbeans.TestBeanHelper.prepare(TestBeanHelper.java:69)
        at
org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfEnd(StandardJMeterEngine.java:248)
        at
org.apache.jmeter.engine.StandardJMeterEngine$StopTest.run(StandardJMeterEngine.java:326)
        at java.lang.Thread.run(Unknown Source)

Did I set up my Javascript wrong?

Also: if I do this:
${__javaScript((${VARONE}*${VARTWO})/${VARTHREE})} //(Note the extra
parenthesis)

I will get a similar error at the same place and time (when I go to stop the
test):
Exception in thread "Thread-77" org.mozilla.javascript.EvaluatorException:
missing ) in parenthetical (<cmd>#1)

Any help would be greatly appreciated!

Thanks!

-Michael P.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message