1. Always use Collections and organize tests into folders for testing:
Even Though the collection is the top-level of organization, we should have folders that can group together related to requests or demonstrate a detailed workflow.
As our API grows in number and complexity, it will become important to organize our tests so they make sense and can be found easily. Therefore, we suggest using folders/sub-folders to group requests by resource, module type, test suite, and workflow.
P.S. If required, we can run specific folder(s) inside a collection using “–folder” argument.
2) Use global/environment/collection variables:
Postman also allows us to store data from previous tests into global/collection variables. These variables can be used exactly like environment variables. For example, there is an API that requires data received from another API (chaining/correlation). We can store the response attribute (or part of the response) and use that as part of a request header, post body, or URL for the subsequent API calls.
3) Use Scripts:
Take advantage of the pre-request and test script tabs to verify the integrity of the code. For example, write tests to make assertions about the correctness of your API. For example, check the response status codes, response body data type, schema validation, etc.
4) Automate your tests with Newman:
The Postman collection runner is a good way to run all our tests and see the results, but it still requires manually initiating the run. If we want to run our Postman tests as part of our CI/CD pipeline, then we should need to use the Newman CLI.
It comes with a comprehensive report that provides complete information on the execution.