Hi,
I have a file with 20k records, from this I need to randomly pick around 150 records and then use in my script, is this possible? Can anyone help me with this?
Hi,
I have a file with 20k records, from this I need to randomly pick around 150 records and then use in my script, is this possible? Can anyone help me with this?
Hey @jency.stella19,
Could you let us know how you’re consuming that data? Is it through the Collection Runner, as a variable in Tests, or through an API?
Used modulo operator to fetch the records from the file.
In Pre-request I fetched the total records and used in the Test script to do my testing
//Finding the total number of iterations that are scheduled to run since Total number of iterations === Number of rows in your CSV File
var list = pm.info.iterationCount;
console.log(list);
pm.environment.set(“Total_Records”, list);
In Test script I checked the modulo value and did the tests as needed >> IF ($rownumber%(square root of the total number of records in file))=0 {do you test} else {postman.setNextRequest(null);}