I tried hundred different variations and found out, that it works if the comma
is escaped by \ (e.g. ${__javaScript(Math.max(${x}\,${y}\,${z}))})
Yet, don't understand why or maybe missed something in some JMeter
documentation ...
Still confused,
Danny
> -----Ursprüngliche Nachricht-----
> Von: Danny Lade [mailto:[email protected]]
> Gesendet: Montag, 1. Juli 2013 14:19
> An: [email protected]
> Betreff: It seems that javaScript functions with more than one parameter does
> not work
>
> When I'm trying to use a javaScript function with more than one parameter
> (e.g.
> ${__javaScript(Math.max(2,5))} or with variables
> ${__javaScript(Math.max(${x},${y}))}), then I get always an exception like:
>
> 2013/07/01 12:47:32 ERROR - jmeter.functions.JavaScript: Error processing
> Javascript: [Math.max(2]
> org.mozilla.javascript.EvaluatorException: missing ) after argument list
> (<cmd>#1)
> at
> org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.j
> ava:77)
> at
> org.mozilla.javascript.DefaultErrorReporter.error(DefaultErrorReporter.java:64)
> at org.mozilla.javascript.Parser.addError(Parser.java:188)
> at org.mozilla.javascript.Parser.addError(Parser.java:166)
> at org.mozilla.javascript.Parser.reportError(Parser.java:223)
> at org.mozilla.javascript.Parser.reportError(Parser.java:217)
> at org.mozilla.javascript.Parser.mustMatchToken(Parser.java:388)
> at org.mozilla.javascript.Parser.mustMatchToken(Parser.java:378)
> at org.mozilla.javascript.Parser.argumentList(Parser.java:2390)
> at org.mozilla.javascript.Parser.memberExprTail(Parser.java:2523)
> at org.mozilla.javascript.Parser.memberExpr(Parser.java:2442)
> at org.mozilla.javascript.Parser.unaryExpr(Parser.java:2304)
> at org.mozilla.javascript.Parser.mulExpr(Parser.java:2229)
> at org.mozilla.javascript.Parser.addExpr(Parser.java:2213)
> at org.mozilla.javascript.Parser.shiftExpr(Parser.java:2194)
> at org.mozilla.javascript.Parser.relExpr(Parser.java:2169)
> at org.mozilla.javascript.Parser.eqExpr(Parser.java:2141)
> at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:2130)
> at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:2119)
> at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:2108)
> at org.mozilla.javascript.Parser.andExpr(Parser.java:2097)
> at org.mozilla.javascript.Parser.orExpr(Parser.java:2086)
> at org.mozilla.javascript.Parser.condExpr(Parser.java:2062)
> at org.mozilla.javascript.Parser.assignExpr(Parser.java:2033)
> at org.mozilla.javascript.Parser.expr(Parser.java:2012)
> at org.mozilla.javascript.Parser.nameOrLabel(Parser.java:1765)
> at org.mozilla.javascript.Parser.statementHelper(Parser.java:1032)
> at org.mozilla.javascript.Parser.statement(Parser.java:901)
> at org.mozilla.javascript.Parser.parse(Parser.java:540)
> at org.mozilla.javascript.Parser.parse(Parser.java:478)
> at org.mozilla.javascript.Context.compileImpl(Context.java:2348)
> at org.mozilla.javascript.Context.compileString(Context.java:1335)
> at org.mozilla.javascript.Context.compileString(Context.java:1324)
> at org.mozilla.javascript.Context.evaluateString(Context.java:1076)
> at org.apache.jmeter.functions.JavaScript.execute(JavaScript.java:88)
> at
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.j
> ava:146)
> at
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.j
> ava:120)
> at
> org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(Funct
> ionProperty.java:92)
> at
> org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(Abstr
> actTestElement.java:273)
> at org.apache.jmeter.config.Argument.getValue(Argument.java:140)
> at
> org.apache.jmeter.config.Arguments.getArgumentsAsMap(Arguments.java:93)
> at
> org.apache.jmeter.engine.PreCompiler.addNode(PreCompiler.java:94)
> at
> org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:1001)
> at
> org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:1002)
> at
> org.apache.jorphan.collections.HashTree.traverse(HashTree.java:986)
> at
> org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.jav
> a:305)
> at java.lang.Thread.run(Unknown Source)
>
> VG Danny