Hi Team,
My test data file “data.json” has 1000 unique records
How can I iterate and run through this 1000 records and pass to my API endpoint ?
I tried below code but it’s always picking only one element, rest all are not getting iterated
sample code
import http from 'k6/http';
import { SharedArray } from 'k6/data';
import { check, sleep } from 'k6';
const token_address = new SharedArray('some data name', function () {
return JSON.parse(open('./data.json')).token_address;
});
export default function () {
const res =http.get(`https://baseurl/list?chain=bsc&token_address=${token_address}`);
check(res, {
'is status 200': (r) => r.status === 200,
});
}
Thanks in advance