-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Feature Description
Background
We are adding support for data files to k6 Studio (grafana/k6-studio#363) and we would like to discuss a feature request.
In short, the user will be able to import a data file (CSV/JSON array) and use values from this file in Parameterization rules (e.g. Pick random row from users.csv and replace id in the request with the value of user_id from that row
). From the UX perspective, the file type won't matter much and the UI of the parameterization rule editor will look something like this:
What will be different is the actual file parsing code in the generated script. For CSVs, we plan on using k6/experimental/csv
in the actual generated script, but the current return format of the parse
function (array of string arrays) makes extraction of the specified value harder and means that we probably need different snippets for JSON and CSV.
What we're asking
Ideally, we'd like an option similar to header: true
in papaparse
:
id,name
1,hdb
const csvRecordsArr = await csv.parse(file, { delimiter: ',' }) // [['id', 'name'], ['1', 'hdb']]
const csvRecordsObj = await csv.parse(file, {delimiter: ',', header: true}) // [{ id: '1', name: 'hdb' }]
Suggested Solution (optional)
No response