Postman: choosing specific rows in

Viewed 18

I'm working on creating an automated process for an in-house QA team, using Postman. Many of our QAs are not well-versed in coding languages, so the solution needs to be relatively simple to manipulate. I'm currently attempting to find a way to select only certain rows from a large data table and run requests using those rows' inputs as variables.

A quick attempt at running a collection that pulls data between rows 3 and 10 is below:

// Declares batch number constant

const batchNumber = pm.iterationData.get("BatchNumber"); 

pm.globals.set("BatchNumber", batchNumber);

console.log (batchNumber);



// Runs new iterations between third and tenth rows of the data table

if (batchNumber > 3 && batchNumber < 10){

console.log (batchNumber); 

console.log ("Running next iteration.")

postman.setNextRequest("DT: NB_AZ");

}



else if (batchNumber > 10 ) { 

console.log ("We've met our limit. Stopping collection runner.");

postman.setNextRequest(null);

pm.globals.unset(batchNumber);

};

So far, I'm running into two issues:

  1. I have not yet been able to figure out a good way to start importing the data with a specific row in the table, rather than starting with the first row of the data table each time
  2. postman.setNextRequest() seems to repeat the same row of the data table again, rather than moving on to the row of the data table when reiterating the request

I've read solutions for similar questions which use Newman, Powershell, etc., but I'm afraid our team will not feel confident using a CLI. Is there a good way to choose the row of the table before the script runs, then move to the next row until a parameter like an iteration count or specific row number has been met?

0 Answers
Related