Search code examples
loopsjmeterbeanshell

How to generate seperate request by loop method & using beanshell preporcessor


Can some one help me out for solution.

Objective/Issue: In Jmeter search by subject name request need to pass the variable "subjName" from BeanshellPreProcessor. "subjName" This variable is having list of subjects which are being sent to "search by subject request" My object is to send the subject separately & FOR EACH SUBJECT A NEW REQUEST SHOULD BE GENERATED.

Bean shell script is as follows

BeanShell

and the search by subject name enter image description here

Please suggest me the logic/script how can I generate different request for different subject?


Solution

  • Define loop with loop count 9

    Add a Counter: Start: 0 Increment: 1 Maximum: 8 Reference Name: cnt

    Inside beanshell use vars.get("cnt") instead of variable i (you don't need the loop inside beanshell)