JMeter-某些函数可以';不能在函数助手中执行

JMeter-某些函数可以';不能在函数助手中执行,jmeter,jmeter-4.0,Jmeter,Jmeter 4.0,关于JMeter函数助手对话框,它是一个很好的工具,但是当期望变量可用时,有些函数无法使用它执行 函数have mandable variable name会引发异常,例如在调用${{u split(a,a,)} 函数还获取NullPointerException: 2018-02-12 08:03:20,603 ERROR o.a.j.e.ClientJMeterEngine: Error calling function ${__split(a,a,)} java.lang.Unsuppo

关于JMeter函数助手对话框,它是一个很好的工具,但是当期望变量可用时,有些函数无法使用它执行

函数have mandable variable name会引发异常,例如在调用
${{u split(a,a,)}

函数还获取NullPointerException:

2018-02-12 08:03:20,603 ERROR o.a.j.e.ClientJMeterEngine: Error calling function ${__split(a,a,)}
java.lang.UnsupportedOperationException: null
    at org.apache.jmeter.threads.UnmodifiableJMeterVariables.put(UnmodifiableJMeterVariables.java:73) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.functions.SplitFunction.execute(SplitFunction.java:99) ~[ApacheJMeter_functions.jar:4.0 r1823414]
    at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:137) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:112) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.functions.gui.FunctionHelper.actionPerformed(FunctionHelper.java:200) [ApacheJMeter_core.jar:4.0 r1823414]
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) [?:1.8.0_25]
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) [?:1.8.0_25]
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) [?:1.8.0_25]
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source) [?:1.8.0_25]
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.processMouseEvent(Unknown Source) [?:1.8.0_25]
    at javax.swing.JComponent.processMouseEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.processEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Container.processEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Container.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Container.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Window.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.access$400(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$3.run(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$3.run(Unknown Source) [?:1.8.0_25]
    at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$4.run(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$4.run(Unknown Source) [?:1.8.0_25]
    at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.run(Unknown Source) [?:1.8.0_25] 
2018-02-11 10:32:38,093 ERROR o.a.j.e.ClientJMeterEngine: Error calling function ${__isVarDefined(a)}
java.lang.NullPointerException: null
    at org.apache.jmeter.functions.IsVarDefined.execute(IsVarDefined.java:53) ~[ApacheJMeter_functions.jar:4.0 r1823414]
    at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:137) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:112) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.functions.gui.FunctionHelper.actionPerformed(FunctionHelper.java:200) [ApacheJMeter_core.jar:4.0 r1823414]
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) [?:1.8.0_25]
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) [?:1.8.0_25]
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) [?:1.8.0_25]
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source) [?:1.8.0_25]
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.processMouseEvent(Unknown Source) [?:1.8.0_25]
    at javax.swing.JComponent.processMouseEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.processEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Container.processEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Container.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Container.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Window.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.access$400(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$3.run(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$3.run(Unknown Source) [?:1.8.0_25]
    at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$4.run(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$4.run(Unknown Source) [?:1.8.0_25]
    at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
另外,JMeter 4中的新函数还获取NullPointerException:

2018-02-12 08:03:20,603 ERROR o.a.j.e.ClientJMeterEngine: Error calling function ${__split(a,a,)}
java.lang.UnsupportedOperationException: null
    at org.apache.jmeter.threads.UnmodifiableJMeterVariables.put(UnmodifiableJMeterVariables.java:73) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.functions.SplitFunction.execute(SplitFunction.java:99) ~[ApacheJMeter_functions.jar:4.0 r1823414]
    at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:137) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:112) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.functions.gui.FunctionHelper.actionPerformed(FunctionHelper.java:200) [ApacheJMeter_core.jar:4.0 r1823414]
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) [?:1.8.0_25]
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) [?:1.8.0_25]
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) [?:1.8.0_25]
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source) [?:1.8.0_25]
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.processMouseEvent(Unknown Source) [?:1.8.0_25]
    at javax.swing.JComponent.processMouseEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.processEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Container.processEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Container.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Container.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Window.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.access$400(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$3.run(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$3.run(Unknown Source) [?:1.8.0_25]
    at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$4.run(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$4.run(Unknown Source) [?:1.8.0_25]
    at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.run(Unknown Source) [?:1.8.0_25] 
2018-02-11 10:32:38,093 ERROR o.a.j.e.ClientJMeterEngine: Error calling function ${__isVarDefined(a)}
java.lang.NullPointerException: null
    at org.apache.jmeter.functions.IsVarDefined.execute(IsVarDefined.java:53) ~[ApacheJMeter_functions.jar:4.0 r1823414]
    at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:137) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:112) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.functions.gui.FunctionHelper.actionPerformed(FunctionHelper.java:200) [ApacheJMeter_core.jar:4.0 r1823414]
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) [?:1.8.0_25]
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) [?:1.8.0_25]
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) [?:1.8.0_25]
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source) [?:1.8.0_25]
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.processMouseEvent(Unknown Source) [?:1.8.0_25]
    at javax.swing.JComponent.processMouseEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.processEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Container.processEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Container.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.Container.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Window.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.Component.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.access$400(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$3.run(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$3.run(Unknown Source) [?:1.8.0_25]
    at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$4.run(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue$4.run(Unknown Source) [?:1.8.0_25]
    at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]

JMeter是应该在函数帮助程序中初始化变量,还是不相关,因此需要添加警告,说明没有变量上下文它是不可用的?

在函数帮助程序对话框中通常不可测试的函数需要一些上下文:

  • 属性集
  • 变量集
这是在以下增强中确定的限制:

如果您有一些想法,请随时提供补丁,例如:

  • 无法创建空的JMeterVariable
  • 用户可以在其中输入一些Groovy代码以填充此对象或其他属性的文本区域
这样,任何函数都可以测试