【问题标题】:How to divide request in loop controller between ThreadsGroups jmeter如何在ThreadsGroups jmeter之间划分循环控制器中的请求
【发布时间】:2022-01-17 21:13:43
【问题描述】:

我在调用请求的时间方面遇到了一些问题。 测试计划结构如下: [1]:https://i.stack.imgur.com/zl1tX.png 我直接从 txt 文件中读取 ulr 路径并发送它 我的代码

LineNumberReader lineReader = new LineNumberReader(new FileReader(new File("C:/tidaltv/LogsReplayer/LoggerReplaySTG_AllRegions/InputData/test.txt")));
String line = null;
int count = 0;

while ((line = lineReader.readLine()) != null) {
  String[] values = line.split(" ");
  for(int i = 0; i < values.length; i++)
  {
    if(values[i].startsWith("/ILogger.aspx?"))
    {
      props.put("path_" + count, values[i]);
      log.info(props.get("path_" + count).toString());
    }
  }


  count++;
}
props.put("LoopCounterValue", count.toString());
props.put("CounterValue", (count-1).toString());
log.info(count.toString());
lineReader.close();

但是当我在一个线程中执行我的测试计划时,例如,20000 请求它需要很长时间。 我可以在多个线程之间划分请求以使其更快

【问题讨论】:

    标签: jmeter


    【解决方案1】:

    不要在普通的 Thread Group 中执行此操作并将值写入 JMeter 属性,只需切换到 setUp Thread Group 并将值写入 CSV 文件即可。

    这样,您将能够使用CSV Data Set Config 并指定线程组中所需的线程数,以便请求并行进行,每个 JMeter 线程(虚拟用户)将从 CSV 文件中获取下一个值每次迭代。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多