Hi guys, please teach me how to write the body response parameters or data extracted by regex, whatever data, in a txt file, or csv or .dat file as a dataset for subsequent requests. ?
Context:
I need to create many room reservations (hotel app) and for each reserved room I have to extract the reserve_id and dump it into a csv file, so that when my script ends to reserve a complete hotel rooms, all those reserves_id should exist in the file, ready to be used as a dataset for subsequent scripts than need to do something with this rooms.
Hi @cesarcorrea
Sorry for the late response. In your use case, it makes sense to try --console-output option, here are the docs:
Then if you are receiving body of responses during your test run (by having discardResponseBodies set to false), you can just output the data you need to console, e.g.:
var response = http.get('...');
if (response.status == 200) {
console.log(response.body); // add parsing of the body as necessary
}
and it should go to the file you passed to --console-output.