3

I want to test concurrency of application, I'm using apache Jmeter for that, the endpoint I'm requesting, needs to have authorization header for authentication, in apache Jmeter HTTP Header Manager i have added a header with the name Authorization with the token value, now lets say I have 5 number of threads (users), when the test runs all the 5 users request with the same authorization token, I want each thread to request with the different token, to simulate the different users and not multiple instances of one user, I hope the question makes sense, How can I make each thread request the api with different token? that is unique header value for each thread's request. Thanks love you guys.

4

1 回答 1

6

如果您有 5 个不同的用户 - 您需要有 5 个不同的令牌。您可以将令牌放入 CSV 文件中,并将CSV 数据集配置添加到您的测试计划

JMeter CSV 数据集配置

完成后,您将能够像${token}HTTP 标头管理器中一样访问 CSV 文件的每个条目(每个线程/迭代都不同)

JMeter HTTP 标头管理器变量

查看JMeter 参数化 - 完整指南文章,了解更多关于使用各种外部数据源(如 CSV 文件、数据库等)执行数据驱动测试的概念。

于 2018-09-25T14:04:47.620 回答