3

I have two CSV files which I need to use in a loop. I am using jp@gc - Variables from CSV file. The contents are:

File #1

File successfuly parsed, 10 variables found:
${1} = e79d29ec-f356-4682-b601-fa6b41c1b40a
${2} = b0c4c235-60c4-462b-bab4-89e65da8e00c
..........

File #2

File successfuly parsed, 10 variables found:
${0} = 88F6470E3E45921AEC8240A4A1C837F323C96E5DB8D06F959A42CE068E5D6477
${1} = 2A2EE03FA798D359963C47F6DB97194BB2F6E053489DBE1539367697679E2D5E

I have a couple of of HTTP requests which will use these values, for each run every request has to take a new value from the CSV file. I have tried using the logic controllers with no luck. Anyone who had success with something similar willing to help me out?

1

You may use a Counter.

Set the upper limit to 10 and use the variable i inside the ${} in each request for entering those values from the CSV. For each request, the counter will increment and take new value from the CSV. enter image description here

Check if this helps.

0

You can do it using Loop Controller and CSV Data Set Config. Firstly, you need to define paramaters in CSV Data Set Config to extract information from your CSV file. You can reuse those paramaters in your HTTP requests. Secondly, you need a Loop Controller to loop through them a certain number of times.

To do so;

Add CSV Data Set Config to your Test Plan
Fill the File name something like : ./src/file/file1.csv
Set File encoding : UTF-8
Enter variable name: file1ID

Do the same things for file2.csv

Add a Thread Group to your project
Add a Loop Controller under Thread group
Uncheck the checkbox in the Loop Controller and set Loop Count to 50 for example
Add a HTTP Request under the Loop Controller
Configure your HTTP Request
You may send as a parameter like this

api/getID?firstparameter=${file1ID}&secondparameter=${file2ID}

With this way everytime ${file1ID} and ${file2ID} should take a new value from the CSV files that you defined.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.