I am working on a Restful API that creates a new token after each request. So, in Postman I am refreshing my token environment variable after each request in Tests like following:
pm.test("Successfull Login Test", function () {
pm.expect(pm.response.text()).to.include('"result":"success"');
var res = pm.response.json();
pm.environment.set("token", res.token);
});
I wonder if it is possible to do this operation for all collection items? I mean I want to say to Postman, run this script after every request.
Thank you.
How about using a collection, and the collection (or folder) can also have tests that are run after every request. Postman Collections/Folder Testing.