如何让Jmeter将CSV数据用于GET参数?

tom*_*ato 3 jmeter

我想在JMETER中实现以下功能

  1. Jmeter加载带有id号的CSV文件
  2. Jmeter中的每个用户/线程都会选择一个ID号并将其添加到他们的HTTP请求中,例如http:www.testsite.com/test.php?id = x
  3. 重复步骤2,选择文件中的下一个ID号.

这样我就可以测试我的servlet是否正在使用连接池执行多个线程.

我试过在这里手动输入值在此输入图像描述

但这不起作用.

架构布局:

在此输入图像描述

谢谢

Ali*_*lik 8

您可以尝试实现您的架构,如下所示:

1.在csv文件中准备测试ID,例如,采用以下格式:

id1
id2
...
idN
Run Code Online (Sandbox Code Playgroud)

2.使用以下架构:

CSV Data Set Config
Filename: [path to your csv-file with test-IDs]
Variable Names: testID  // extracted id can be referred as ${testID}
Recycle on EOF? False
Stop thread on EOF? True
Sharing mode: Current thread // this mode allows EACH thread use ALL values from csv
Thread Group
Number of Threads: N    // count of your test-threads (users)
Loop Count: Forever
. . .
    HTTP Request // your http call
    Server Name or IP: www.testsite.com
    Path: /test.php?id=${testID} // use variable with extracted ID
. . .

  • 只需按照上面的答案实现模式:1.CSV数据集配置应放在测试计划中的线程组之前; 2.使用HTTP请求采样器(http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request)发送您的请求; HTTP请求默认值配置是仅为所有请求设置公共部分的方式 - 例如服务器名称(不是路径). (3认同)