如何从BeanShell(jmeter)中的属性获取值 [英] How to get value from property in BeanShell (jmeter)

查看:121
本文介绍了如何从BeanShell(jmeter)中的属性获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个线程组.我想使用第一组中的变量.在第二组中,此var应该在BeanShell中使用. 因此:在第一个线程组中,我使用以下代码创建了BeanShell断言:

I have got several thread groups. I want to use variable from the first group. In second group this var should be used in BeanShell. So: in first thread group I created BeanShell Assertion with this code:

 ${__setProperty(erroriden, ${erroriden1})};

在第二个线程组中,我有BeanShell预处理器. 如果有这样的行:

In second thread group I have BeanShell pre-processor. If has line like this:

String[] erroriden = (vars.get("erroriden")).split(",");

我尝试了一些类似的变化:

I tried some variations like this:

String[] erroriden = (vars.get("__property(erroriden)")).split(",");
String[] erroriden = (vars.get("${__property(erroriden)}")).split(",");

但是它不起作用. 请帮助在BeanShell预处理器中使用$ {__ property(erroriden)}.

but it doesn't work. Please help to use ${__property(erroriden)} in BeanShell pre-processor.

推荐答案

在第一个线程组中:

props.put("erroriden", vars.get("erroriden1"));

在第二个线程组中:

String[] erroriden = props.get("erroriden").split(",");

  • JMeterVariables 范围仅限于当前线程仅组
  • JMeter属性是常见的 Java属性 JVM实例是全局的
  • 请参见如何使用BeanShell:JMeter最喜欢的内置组件有关在JMeter中使用Beanshell的更多信息的指南.
    • JMeterVariables scope is limited to the current thread group only
    • JMeter Properties are usual Java Properties which are global for JVM instance
    • See How to use BeanShell: JMeter's favorite built-in component guide for more information on using Beanshell in JMeter.
    • 这篇关于如何从BeanShell(jmeter)中的属性获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆