运行如何根据特定用户使用jmeter的特定csv文件

How run specific csv file based on specific users using jmeter

我有这样的测试计划:

Thread group |---User parameter(user'scredentials mention there) |--Request body (same for the users) |----csv file1 |-----csv file2

现在如果是users.name==joe,这应该执行csvfile1如果是user.name==nmeon,通过用户参数执行csvfile2我在JMeter控制台中得到了用户名。

如何使用 IF controller/bean 编写脚本 shell 如果我使用该脚本会为此编写什么?

你基本上有两个选择:

  1. 将文件名更改为 nmeon.csvjoe.csv 并在 CSV 数据集配置 "Filename" 部分使用 ${user.name}

  2. 使用 2 If Controllers 喜欢:

    • 如果控制器,条件:${user.name} == "joe"
      • 针对 joe 的测试逻辑
    • 如果控制器,条件:${user.name} == "nmeon"
      • 特定于 nmeon 的测试逻辑
  3. 使用Switch Controller(方法类似于If Controllers)