Dig*_*nta 2 csv json jmeter load-testing
在我的项目中,我正在使用Jmeter进行负载测试。
我创建了一个测试计划,如下所示:
下一位采样者将提交一个请求。该采样器接受两个参数:sessionId和licenseRequest。有关Java脚本的一些详细信息如下:
url: "groovy/enqueue",
type: "POST",
global: false,
data: {sessionId: uSessionId, licenseRequest: JSON.stringify(requestJSON) },
dataType: "text",
Run Code Online (Sandbox Code Playgroud)为了提交请求,我创建了一个csv文件。
csv类似于这样:
条目1:
{"activations":["<activation-code>","<activation-code>"],"email":"<emailIdofUser>","csvEntries":[{"model":"<modelname>","serial":"<serialNo>"}],"comment":"testing jmeter"}
我发现,在第二个采样器中提交请求时,后期请求格式错误:
POST data:
sessionId=vZNjFjW38cid&licenseRequest=%3CEOF%3E
Run Code Online (Sandbox Code Playgroud)
如您所见,licenseRequest的值不正确。它正在发送EOF,这是不希望的。

确保正确拥有CSV数据集 Recycle on EOF和Stop Thread on EOF值:
Recycle on EOF = True(即指示jmeter返回到CSV文件的顶部);Stop Thread on EOF = False是否使用循环控制器,Stop Thread on EOF = True是否使用while控制器,并在读取整个csv数据集后要停止;Sharing mode: Current thread group为CSV数据集配置(CSV条目的数量应该是在这种情况下,相同的线程数,或者Recycle on EOF? False应该是否则设置);Sharing mode: Current thread为CSV数据集配置设置。不要忘记查看jmeter.log或使用Log Viewer来检测csv使用的任何问题。
最简单的情况如下:
Test Group
Number of Threads = 10
CSV Data Set Config (User Logins)
Filename: ... (your csv-file should have 10 entries)
Recycle on EOF = False
Stop Thread on EOF = True
Sharing Mode = All threads
CSV Data Set Config (License Request)
Filename: ... (your csv-file should have 10 entries)
Recycle on EOF = False
Stop Thread on EOF = True
Sharing Mode = All threads
Login Sampler
License request Sampler
Run Code Online (Sandbox Code Playgroud)
这将产生10个线程,每个线程具有独立于csv的登录条目和许可请求条目。
| 归档时间: |
|
| 查看次数: |
4754 次 |
| 最近记录: |