在可变大小的groovy中创建数组 - Jmeter

时间:2017-10-21 17:36:12

标签: arrays groovy jmeter

我将用户定义的变量用于循环。

在循环中我想发出HTTP请求并在数组中存储响应值,数组的名称是Password(密码' lkjslf789078897'的示例)。 在循环之前,我在groovy中创建了一个数组,并试图给出循环的大小。 我遇到这个问题,数组的大小是由于某种原因51,而变量$ Loop_Number是3。

**另一个问题是如何将空密码数组传递给循环内的采样器。 所有目的都是创建一个包含http请求中所有密码的数组。

def arr_length = vars.get('Loop_Number');
def Password = new String[vars.get('Loop_Number')];
System.out.println(" Password array length is:  " + Password.size());
System.out.println(" array length shoul be is:  " + arr_length);

enter image description here

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:1)

它的常规magic,你正在调用String对象的sylius_attribute: resources: product: attribute_value: classes: model: AppBundle\Entity\ProductAttributeValue 函数,当你调用size()时,groovy实际上使用了字符串length()。此功能在Java中不起作用。

在您的情况下,值3:

size()
相关问题