如何在jmeter中实现嵌套循环? [英] How to implement nested loop in jmeter?

查看:661
本文介绍了如何在jmeter中实现嵌套循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑如何使用JMeter测试具有两个参数的servlet:X和Y.

I am thinking about how to test a servlet with two parameters: X and Y, using JMeter.

X和Y是从0到100的随机数.

X and Y are random numbers from 0 to 100.

我正在考虑实现类似这样的嵌套循环

I am thinking of implement a nested loop which is something like

for (int x = 0; x <= 100; x++)
    for (int y = 0; y <= 100; y++)
        servlet?param1=x&param2=y

任何人都可以提示如何使用CounterLoop Controller或其他方式实现此功能吗?

Could anyone give a hint on how to implement this using Counter and Loop Controller or something else ?

推荐答案

您的架构可能如下所示:

Your schema may be like the following below:


    Thread Group
        User Defined Variables
        maxX = 100
        maxY = 100
        Loop Controller X
        Loop Count: ${__BeanShell(Integer.parseInt(vars.get("maxX"))+1)}
        Counter X
        Start: 0
        Increment: 1
        Maximum: ${maxX}
        Reference Name: loopX
            Loop Controller Y
            Loop Count: ${__BeanShell(Integer.parseInt(vars.get("maxY"))+1)}
            Counter Y
            Start: 0
            Increment: 1
            Maximum: ${maxY}
            Reference Name: loopY
                    YOUR HTTP Request
                    servlet?param1=${loopX}&param2=${loopY}
                    . . .

在这里您可以找到解决方案,但使用的是CSV数据源而不是计数器:
循环2个CSV文件

Here you can find solution for your case but with CSV data sources used instead of counters:
Looping 2 CSV files

这篇关于如何在jmeter中实现嵌套循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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