我想在 JMeter 之外单独有一个脚本文件,它有一些 JS 功能,比如${__RandomString(10,195165984,)}.
当我以 .groovy 格式保存文件然后在脚本文件 (FileName) 中调用它时,出现如下错误:
javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.$() is applicable for argument types: (Script7$_run_closure1) values: [Script7$_run_closure1@1aa89172]
Possible solutions: is(java.lang.Object), any(), get(java.lang.String), any(groovy.lang.Closure), use([Ljava.lang.Object;), wait()
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:324) ~[groovy-all-2.4.15.jar:2.4.15]
at org.codehaus.groovy.jsr223.GroovyCompiledScript.eval(GroovyCompiledScript.java:72) ~[groovy-all-2.4.15.jar:2.4.15]
at javax.script.CompiledScript.eval(CompiledScript.java:92) ~[?:1.8.0_201]
at org.apache.jmeter.util.JSR223TestElement.processFileOrScript(JSR223TestElement.java:194) ~[ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.assertions.JSR223Assertion.getResult(JSR223Assertion.java:49) [ApacheJMeter_components.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.processAssertion(JMeterThread.java:901) [ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.checkAssertions(JMeterThread.java:892) [ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:565) [ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:486) [ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:253) [ApacheJMeter_core.jar:5.0 r1840935]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
当我在 JMeter 脚本中编写这些函数时,这很好用。有什么我想念的吗?或者我们不能在外面调用这些函数?
茅侃侃
湖上湖
相关分类