JMeter - 某些函数无法在 Function Helper 中执行
JMeter - some functions can't be executed in Function Helper
关于 JMeter Function Helper Dialog,它是一个很棒的工具,但是在期望变量可用时无法使用它执行某些函数
__split 函数具有强制变量名,例如在调用 ${__split(a,a,)}
时抛出异常
另外函数 __isVarDefined 得到一个 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.access0(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
at java.security.ProtectionDomain.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
at java.security.ProtectionDomain.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
at java.security.ProtectionDomain.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]
JMeter 4 中的新函数 __isVarDefined 也得到一个 NullPointerException:
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.access0(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
at java.security.ProtectionDomain.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
at java.security.ProtectionDomain.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
JMeter 是否应该在 Function Helpers 中初始化变量,或者它是否无关紧要,因此需要添加一个警告,说明它在没有变量上下文的情况下不可用?
函数助手对话框中通常不可测试的函数需要一些上下文:
- 属性设置
- 变量集
...
这是在以下增强中确定的限制:
如果您有任何想法,请随时贡献补丁,例如:
- 可以创建一个空的 JMeterVariable
- 一个文本区域,用户可以在其中输入一些Groovy代码来填充此对象或其他属性
这样任何函数都可以测试。
关于 JMeter Function Helper Dialog,它是一个很棒的工具,但是在期望变量可用时无法使用它执行某些函数
__split 函数具有强制变量名,例如在调用 ${__split(a,a,)}
另外函数 __isVarDefined 得到一个 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.access0(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
at java.security.ProtectionDomain.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
at java.security.ProtectionDomain.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
at java.security.ProtectionDomain.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]
JMeter 4 中的新函数 __isVarDefined 也得到一个 NullPointerException:
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.access0(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
at java.security.ProtectionDomain.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
at java.security.ProtectionDomain.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
JMeter 是否应该在 Function Helpers 中初始化变量,或者它是否无关紧要,因此需要添加一个警告,说明它在没有变量上下文的情况下不可用?
函数助手对话框中通常不可测试的函数需要一些上下文:
- 属性设置
- 变量集 ...
这是在以下增强中确定的限制:
如果您有任何想法,请随时贡献补丁,例如:
- 可以创建一个空的 JMeterVariable
- 一个文本区域,用户可以在其中输入一些Groovy代码来填充此对象或其他属性
这样任何函数都可以测试。