CSV Data files for multiple requests within one collection

Hi,

I am new to postman collections and runner. I have a requirement something like the following -

  1. I have multiple end to end tests within one collection. Each test is a folder with multiple requests within.

  2. I want to pass one csv datafile that has data for all the four end to end tests to the runner. The data file has 5 rows. One for the headers and four for the four tests.

  3. I want Test 1 to pick data from Row 2, Test 2 to pick data from Row 3… so on and so forth

  4. I want to execute Test1, Test2 and Test3 (not Test4) in one go.

Could you please let me know if this is possible and how to accomplish this?

Thank you,
Amruta

1 Like

Hey @amruta.kale. That is a common use case and is supported by the app. Look at this thread Running a request multiple times with different data sets, it might help you get started in the right direction.
Your 4th point can be handled by using postman.setNextRequest(null). Read more about conditional workflows here. https://www.getpostman.com/docs/v6/postman/scripts/branching_and_looping

Feel free to reply here in case you are stuck and need further assistance.

Thank you @deepak.pathania

My requirement is a little bit different from what’s mentioned in the thread you provided.
I don’t want to run the same test multiple times with different data.
I want a single data file to contain data for multiple different tests - Test1, Test2, Test3 etc in my example above. Any pointers?

Thanks,
Amruta

Hey @amruta.kale, sorry for misunderstanding your use case. On revisiting the question, I realized that this is not currently supported directly in the app but here is a small workaround that might help.

You can pass the csv data file in the pre-request script of your first request or create a dummy request for this. Now you can try parsing the csv file and store different rows as different global variables as per the use case. In each test, you can access the stored data from the global variable and use it in that particular test. This will require additional parsing and fetching logic on your end but might help in your use case.

Hope this helps.

I have got a similar requirement.
TestCase 1 wants to use Row1, TestCase2 wants to use Row3. All this has to happen in a single iteration. Any advancement in postman till now on this?