如何在jmeter

时间:2018-08-14 03:30:09

标签: javascript jmeter

我在JMETER中遇到以下情况

/ request1 返回一个UUID值,该值保存为UUIDVar

/ request2包含上面返回的UUID,该UUID正在转换为另一种格式 此处的javascript代码,它返回转换后的值

static urlSafe(guid: string): string {
    let alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
    let out = '';
    guid = guid.replace(/-/g, '');
    let prev = 0;
    for (let place = 0; place < 32; place++) {
        let val = parseInt(guid.charAt(place), 16);
        switch (place % 3) {
            case 0:
                prev = val;
                break;
            case 1:
                out += alphabet.charAt((prev << 2);
                prev = val & 3;
                break;
            case 2:
                out += alphabet.charAt((prev << 4));
                break;
        }
    }
    out += alphabet.charAt((prev << 4));
    return out;
}

如何将UUIDVar值传递给上述函数,并将转换后的值保存到变量中,并在随后的jmeter中使用api调用

0 个答案:

没有答案