mercredi 30 août 2017

How to store data in an array that is stored in a variable?

Following is my problem:

I am testing a system now, that has multiple ID's in every request. There are 2 ID's I want to store in an array and let them run again a response later.

Following is the Body I recieve

{
"id" = 1234;
"Name" = "Meier"
}

So, I store the ID normally with

var body = JSON.parse(responseBody);
postman.setEnvironmentVariable("ID", body.id);

with that I can store 1 ID in the variable, but can't put a second one in it. For that I would have to duplicate the request, set a second variable, change code everytime the needed cases are changed.

What I want to know now is: How can I store multiple ID's in a Environment Variable to compare them with a response at the end of the collection?

Aucun commentaire:

Enregistrer un commentaire