how to set counter of loop inside loop correctly inside jmeter?

后端 未结 1 1100
囚心锁ツ
囚心锁ツ 2021-01-18 06:08

I have jmeter flow like this:

ThreadGroup
--Sampler to get the number of items and store to vars(\"numItem\",XYZ)
--LoopController on $numItem
-----Sampler t         


        
相关标签:
1条回答
  • 2021-01-18 06:52

    In your example you can define additional var maxCount = subItem - 1 and set it as value of "Maximum" field for "Counter" instance, as shown below:

    In sampler where numSubitem is set (before 2nd loop):

    int numSubitem = 10;
    int maxCounter = numSubitem - 1;
    vars.put("numSubitem",Integer.toString(numSubitem));
    vars.put("maxCounter",Integer.toString(maxCounter));
    

    I've used Beanshell Sampler for test, you can use Beanshell Postprocessor, e.g.

    In Counter instance:

    enter image description here

    So counter will iterate as in your description.

    0 讨论(0)
提交回复
热议问题