Not clear to me how to create a sequence of tests

Hi: I have what seems to me to be a common need, but I can’t figure out a simple way to do it in Postman. Specifically, I want to execute a series of requests against my backend, taking data from earlier tests and passing it to later tests. ie:

  1. Request entity A. Make a copy as A2. Modify some of the resulting A data.
  2. Post the modified entity A, check the result.
  3. Delete modified entity A
  4. Save entity A2, restoring the original state of the database.

The above lets me test my GET, PUT, DELETE, POST operations in sequence, but in order to do it in Postman I have code in 4 different requests that writes environment variables to pass the data between requests. There’s no simple way to see all that code at once. Am I missing something or is this just how Postman works?

Apologies if this is a stupid question - perhaps I’ve missed something very obvious, or am doing something wrong.

  • bill

Hey - that’s definitely not a stupid question. You can use Postman variables to store data in one script and access it in next ones.

More about variables:
https://www.getpostman.com/docs/postman/environments_and_globals/variables

One blog post around chaining your requests: