In JMeter How to iterate the requests with nested conditions based on defined input
In my application, we have 3 requests
- Get Vehicle Type (we need to choose car, bikes)
- Enter Brand Name of the car/bike
- Enter model name of car/bike
I have only three requests but based on my inputs, I need to iterate the loops for request. In the below table given an example flow for iterations
: Enter Vehicle Type - Car : 1st request :
: Enter Brand Name - TATA : 2nd request with first brand :
: Enter model - Altroz : 3rd request with first model :
: Enter model - Nexon : 3rd request with second model :
: Enter model - Harrier : 3rd request with third model :
: Enter Brand Name - Maruthi : 2nd request with second brand :
: Enter model - Swift : 3rd request with first model :
: Enter model - Baleno : 3rd request with second model :
In the above example first request will be sent only once but brand and model requests iterated based on input. In the above table for brands I need to iterate 2 times and inside 1st brand I need to iterate models 3 times and inside 2nd brand need I reiterate models 2 times. Can we achieve this using any loop controller or do we need to write scripts to achieve the same and also how can we set csv data for the same when multiple users or threads running the same
CodePudding user response:
I think in order to achieve the same you need to have separate CSV files for the same.
Like:
vehicleType.csv
Car
brands.csv
TATA Maruthi
TATA.csv
Altroz Nexon Harrier
Maruthi.csv
Swift Baleno
Once done in order to read the same you could use __CSVRead() function
Using Loop Controller is a good idea, you can use __groovy() function to count the number of lines in this or that CSV file so you will know how many time to loop for the same