gpt4 book ai didi

JMeter - 某些函数无法在 Function Helper 中执行

转载 作者:行者123 更新时间:2023-12-01 15:16:16 29 4
gpt4 key购买 nike

关于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.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]

还有新功能__isVarDefined从 JMeter 4 获取 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.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 是否应该在 Function Helpers 中初始化变量,或者它是否无关紧要,因此需要添加一个警告,说明它在没有变量上下文的情况下不可用?

最佳答案

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

  • 属性集
  • 变量集...

这是在以下增强中确定的限制:

如果您有任何想法,请随意贡献一个补丁,例如:

  • 可以创建一个空的 JMeterVariable
  • 一个文本区域,用户可以在其中输入一些 Groovy 代码来填充此对象或其他属性

这样任何功能都可以测试。

关于JMeter - 某些函数无法在 Function Helper 中执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48761022/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com