Can the global function be replaced by collection/folder level pre-request and test scripts?

The post https://blog.getpostman.com/2017/07/28/api-testing-tips-from-a-postman-professional/ describe a few advanced tips.

However, it was published 2 years ago. It sounds a bit dated.

The reuse code section is cool. But postman already have collection/folder level pre-request and test scripts. does it make the global function idea irrelevant?

Thanks

1 Like

You can reuse some code by storing it in the collection / folder but you need to initialize the run from there.

What this means is the following: you can define a function foo in the collection / folder but you cannot call it from a request. You still need to run the function from there (after defining it).

So reusing code is, at least for now, still limited but it has improved.

Does this help?