1. 目的
從上一個接口的BeanShell PostProcessor, 捕獲所需信息
傳入下一個接口的BeanShell PreProcessor,作爲參數傳遞
每一個接口請求, 一個線程組
2. 方法有兩種
方法1:
BeanShell PostProcessor 存儲
props.put("QueueName",que);
BeanShell PreProcessor 獲取
String QueueName = props.get("QueueName");
方法2:
BeanShell PostProcessor 存儲
${__setProperty(Queuename,que,true)};
BeanShell PreProcessor 獲取
String QueueName ="${__P(QueueName,)}";
3.注意點
1.方法二線程組內參數傳遞, 獲取可以不用加引號
String QueueName =${__P(QueueName,)
但線程組間,參數傳遞, 要加引號
String QueueName ="${__P(QueueName,)}";
在BeenShell中引用外部參數需要以String類型的方式引用
如果不加引號會提示報錯信息
ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval Parse error at line 17, column 26 : Error or number too big for integer type: 1586417240652
jmeter會默認將其識別成int型數據,說明jmeter並不是默認以String類型對數據進行讀取的:範圍-2147483648到2147483647,如果超出這個範圍(例如2147483648這個數字):jmeter控制檯則會拋出上面的異常