mercredi 28 octobre 2020

Add dynamic variable does not work with PostMan

I'm trying to variable incremented automatically with POSTMan

the collection details :

Body :
{
  "userName": "test",
  "text": "I've inquery please ",
  "receiverID": 0,
  "receiverUserName": "",
 
  "creatorUserId": 29,
 
  "id": 0
} 

Pre-request Script :

var value = pm.environment.get("param");

if( !value) {
    pm.environment.set("param", 1);
}

Test

pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
    
});

var value = pm.environment.get("param");

pm.environment.set("param", value.param + 1);

and here is the runner screen shoot enter image description here

Aucun commentaire:

Enregistrer un commentaire