【问题标题】:Jmeter run threads sequentially for different loop countsJmeter针对不同的循环计数顺序运行线程
【发布时间】:2018-11-05 20:57:53
【问题描述】:

我有类似以下线程的场景

1thread ---2 loops
 --request1(post)
   --json extractor(id)
2thread ---4loops
 --request2
 --request3
3thread ---2loops
 --request4(deleting that created in 1st thread using id extracted)

我必须执行如下请求

request1
request2
request3
request2
request3
request2
request3
request2
request3
request4
request1
request2
request3
request2
request3
request2
request3
request2
request3
request4

【问题讨论】:

    标签: jmeter jmeter-plugins jmeter-3.2 jmeter-4.0 jmeter-maven-plugin


    【解决方案1】:

    您的设计过于复杂,我的期望是您不需要像 pass the id between thread groups which is possible 那样需要不同的 Thread Groups,但在您的情况下是不必要的)

    我建议您使用 Loop Controller 而不是这个,您需要进行 > 1 次迭代

    示例测试计划:

    • 线程组(带 1 个线程和 1 个循环)
      • 回路控制器(带 2 个回路)
        • 请求 1
          • JSON 提取器
        • 回路控制器(带 4 个回路)
          • 请求 2
          • 请求 3
        • 请求 4

    演示:

    【讨论】:

    • 在这种情况下我有一个疑问,线程数和循环数是否相似?我的意思是在线程组上我们有线程数和循环数,我认为两者都有不同的功能,如果想为不同的线程运行请求 2 和请求 3 怎么办
    【解决方案2】:

    您可以做的一件事是通过在循环计数字段中指定 -- ${__P(LoopCount1,2)} 将运行时的循环计数值传递给脚本。 p>

    将变量 ${__P(LoopCount1,2)} 用于第一个循环,${__P(LoopCount2,2)} 用于第二个循环,${__P (LoopCount3,2)} 第三个并尝试使用非 gui 模式在命令的帮助下运行脚本 -

    jmeter -n -t (location of script) -l location for result file -j location for logfile -JThreadGroup=%ThreadGroup% -JRampUpTime=%RampUpTime% -JLoopCount=%LoopCount1% -JLoopCount=%LoopCount2% -JLoopCount=%LoopCount3%

    【讨论】:

      猜你喜欢
      • 2016-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-28
      • 1970-01-01
      • 2017-02-23
      相关资源
      最近更新 更多