I have a request which inserts some data and the ID should be incremented every time by +1. The request is working fine in Postman runner, but not in Newman where is fails after 1st execution.
PRE-REQUEST SCRIPT - Get the variable value and increate is by 1
let x = pm.environment.get(“SystemSettingTypeIncrementer”);
pm.environment.set(“SystemSettingTypeIncrementer”, Number(x) + 1);
TEST SCRIPT - Set the variable value with new value
pm.environment.set(“SystemSettingTypeIncrementer”, jsonData.Type);
console.log(“SystemSettingTypeIncrementer is set to:”, jsonData.Type);