如何从csv中拆分数据并存储在变量中,以便以后在Jmeter中使用

时间:2022-01-18 15:40:17

I tried my best but no luck. Experts please help

我尽我所能但没有运气。专家请帮忙

I'm trying to get the vin numbers from csv file and using BeanShellPreProcessor to split

我正在尝试从csv文件中获取vin数字并使用BeanShellPreProcessor进行拆分

Here is my code

这是我的代码

"vin" is the datasheetname and storing in variable t. I can successfully print the value of t in the Jmeter console.

“vin”是数据表名称并存储在变量t中。我可以在Jmeter控制台中成功打印t的值。

Now I took the value that I got in t, and want to get the string starting from 10th Index to 17th Index and want to put that splitted string into a variable that I can use in my SOAP Request.

现在我获取了t中的值,并希望从第10个索引到第17个索引获取字符串,并希望将该分割字符串放入我可以在SOAP请求中使用的变量中。

But when I use in the SOAP Request like this ${output}, it is getting as is instead of the value

但是,当我在SOAP请求中使用这样的$ {output}时,它将按原样而不是值

what am I doing wrong?

我究竟做错了什么?

String t = vars.get("vin"); System.out.println(timer);

String t = vars.get(“vin”);的System.out.println(定时器);

string varm = t.substring(10, 17); vars.put("output", varm.toString());

string varm = t.substring(10,17); vars.put(“output”,varm.toString());

1 个解决方案

#1


You made a mistake in second line:

你在第二行犯了一个错误:

System.out.println(timer)

should be:

System.out.println(t)

And

string

should be:

String

By the way you should use Groovy within JSR223 rather than beanshell

顺便说一句,你应该在JSR223而不是beanshell中使用Groovy

#1


You made a mistake in second line:

你在第二行犯了一个错误:

System.out.println(timer)

should be:

System.out.println(t)

And

string

should be:

String

By the way you should use Groovy within JSR223 rather than beanshell

顺便说一句,你应该在JSR223而不是beanshell中使用Groovy