Query Parameter can be access through .csv file?

Hi Team,

I have one scenario whereas need to change query parameter values based on the related scenario.
If I can create one individual scenario then might be 50 sets of request needs to be create based on the different query parameter.

Can we do with .csv file where we can store different sets of query parameter at each row and iteration can follow up.

If you see in the above image, I need to change values based on the requirement.
Let me know if needed any other info.

Hi @aakashjain8693,

Due to some constraints, I couldn’t work on .csv files. So you please try the below with the .csv file.

So you are saying that for every iteration you have the different set of query parameters ready with you?

If that’s case, have your .CSV files ready and the process is similar to usual data driven approach.

For example:

Under Pre-request script, add the desired fields you need:

pm.environment.set("pageNumber", data.pageNumber);
pm.environment.set("pageSize", data.pageSize);

so on…

then the process is same, the csv file name is as “data.csv”

and select the file it automatically loads with number of iterations.

1 Like

Perfect, What I was doing mistake, Trying to put same stuff in test section instead of pre-request script section.

Test section something like I was trying
variable name= data.pageNumber;

If you have that data in a CSV file and the variable names are unique and not used in any other scope - you should just be able to use the {{var_name}} syntax in the params without the need to add anything to the scripts.

Thanks @dannydainton, Worked for me.
Before the scripting, I was doing exactly the same but variable names were duplicate.

Having the same name is fine but you just need to think about the scope of the variables and understand why one might be chosen over another one.