Looping in Jmeter

Why we go for looping ?

    Ø  To avoid the length of scripts

    Ø  To make our scripts re-usable if our flow having repeated actions .



















Steps to create loop:
1.Create a counter by using beanShell sampler (Do not use inbuilt counter)
   Add line vars.put(“counter name”,”value”) inside beanShell sampler
       2.Create loop counter and add all transection inside loop counter which you want to do for multiple times




















3.Add BeanShell postprocessor at  http sampler which we are going to loop
  > Call counter inside beanShell PostProcessor.This counter we are going to use for dynamic variable     creation
  > Create dynamic variable using counter and store values inside it
 Ex: vars.put(“dynamicVariable”+counter,itemValueToStore)



















      >Increment the counter at the end of loop refer above image

4. Create httpSampler by using beanShellPreProcessor to save loop

    Ex: If our transaction is to save 100 loop item then at the time of save we need to create our                       httpsample to replace recorded save transaction httpsampler

 

















 >Inside beanShellPreProcessor call created dynamic variable and save it in another variable
         Ex: newVariable = vars.get(“dynamicVariable”+j); here j value in loop(refer above image)
    >To create name and its value inside httpsampler use below command
         Ex: sampler.addArgument(“Name”,”Value”);

Thanks For Reading My Post
Feel Free To Comment Your Queries

Comments

Post a Comment

Popular posts from this blog

How To Run JMeter GUI Mode In Ubuntu Servers

SELENIUM

Sql Basics With Examples