jmeter beanshell 变量传递

本文介绍了在JMeter中使用BeanShell时遇到的变量错误,并展示了如何使用BeanShell内置变量如log、ctx、vars、props、prev和sampler进行交互。通过示例代码,解释了如何读取和设置JMeter变量与属性。
摘要由CSDN通过智能技术生成

 如果写成这样会报错:


${__BeanShell(${__threadNum}*2,ToatlAmount)};

${__BeanShell(${__Random(1,99999,)},DayNum)};

//${__BeanShell(vars.put("BXReason"\,"${__UUID}"))};
${__BeanShell(${__threadNum},BXReason)};

报错信息:

2018-12-20 01:42:30,820 ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``StandardJMeterEngine*2;'' : illegal use of undefined variable, class, or 'void' literal
2018-12-20 01:42:30,820 WARN o.a.j.f.BeanShell: Error running BSH script
org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``StandardJMeterEngine*2;'' : illegal use of undefined variable, class, or 'void' literal
at org.apache.jmeter.util.BeanShellInterpreter.bshInvoke(BeanShellInterpreter.java:183) ~[ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.util.BeanShellInterpreter.eval(BeanShellInterpreter.java:189) ~[ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.functions.BeanShell.execute(BeanShell.java:100) [ApacheJMeter_functions.jar:5.0 r1840935]
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:136) [ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:111) [ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.testelement.proper

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值