首页 文章

如何使用Jmeter对使用唯一用户名和密码登录的100个并发用户进行负载测试?

提问于
浏览
0

我的测试计划场景是对100个并发用户登录网站进行负载测试 .

我创建了Threadgroup,线程数为100 .
创建的CSV文件,其中包含100个用户登录详细信息(唯一的用户名和密码) .
在Sign in sample下,从Thread Group - > PreProcessors中添加了一个“User Parameter” . 使用__CSVRead函数添加变量,该函数从文件test.csv中读取值 .
选择登录示例并将userid和密码的值更改为$
和$ .

这是正确的方法,还是有其他方法可以实现这一目标?

1 回答

  • 0

    如果这对你有用并按预期工作,那就够了 .

    但看起来像CSV Data Set Config__CSVRead function更适合和更容易用于多用户场景:

    Thread Group
    Number of Threads: N    // count of your test-threads (users)
    Loop Count: 1
        CSV Data Set Config
        Filename: [path to your csv-file with usernames / passwords]
        Variable Names: username,pwd    // extracted values can be referred as ${username}, ${pwd}
        Recycle on EOF? False
        Stop thread on EOF? True
        Sharing mode: Current thread group
        . . .
        HTTP Request // your http call
        . . .
    

    根据documentation

    该功能不适合与大文件一起使用,因为整个文件存储在内存中 . 对于较大的文件,请使用CSV数据集配置元素或StringFromFile .

    这里有非常详细的指南:

相关问题