Data driven testing using CSV file

Hi All,

I am trying to test a scenario where I need to validate certain parameters for a few telecom services (data speeds). A part of the xml request is below:

ServiceName>{{ServiceName}}</ServiceName

I have created a csv file and entered 12 data speed values under the column “ServiceName.” Examples of values are : F30M30M, F50M50M, F75M75M and so on.

My queries are:

  1. For every iteration, I want that the service name should get saved in a collection variable first and then the test scripts should run. For example, first iteration value is F30M30M. When the first iteration runs, the value F30M30M should get set in a collection variable so that I can use it in the corresponding test scripts.

  2. Is there any way to use “ServiceName” column name that I set in the CSV file directly in my test scripts?

You can access the data in the CSV file through the data object.

It would be data.columnheader, for example…

let serviceName = data.ServiceName;
pm.collectionVariables.set("serviceName", data.ServiceName);

Using CSV and JSON Data Files in the Postman Collection Runner | Postman Blog

1 Like

Thanks a lot for your reply. it worked like a charm.