我需要测试具有 100 个用户的站点的各种链接(无需登录),并使用 JMeter 循环多次。我想将这些链接放入“CSV 文件”中,以便从文件中读取所有要测试的链接。
如何完成这个任务?
最佳答案
准备带有测试参数列表的 csv 文件,并使用它来参数化您的测试采样器,至少使用以下内容:
-
查看以下链接了解详细信息:
How to get Jmeter to use CSV data for GET parameters?
Use jmeter to test multiple Websites
use csv parameters in jmeter httprequest path
Force a thread to use same input line when using CSV Data Set Config Jmeter 功能:
Variables From CSV采样器来自 jmeter-plugins .
1. 在 csv 文件中准备测试网址,例如格式如下:
url1
url2
...
urlN
确保测试 URL 不包含 http://
前缀(根据 HTTP Request params -> 服务器)。
2.为您的脚本使用架构,如下所示:
CSV Data Set Config:
Filename: [path to your csv-file with test-urls]
Variable Names: testURL
Recycle on EOF?: True
Stop thread on EOF?: False
Sharing mode: Current thread
Thread Group:
Number of Threads: N
Loop Count: M
HTTP Request // your http call
Server Name or IP: ${testURL} // use variable with extracted URL
这将启动 N 个用户,每个用户将从测试 URL 列表中读取 M 个条目。如果 M > 测试 URL 列表中的条目数,则用户将在 EOF 时回收该列表。
关于csv - 使用 CSV 文件读取测试数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14476448/