Newman - Running Tests

What would be the ideal situation in Newman to run a test which resulted in a variable and later use that variable in other tests. I know it is not hard with collections or environment variables in Postman, but is there any better way to communicate?

Please note: For some reason you’re forbidden from using the Postman API.

What kind of options are you looking for? The best practice is typically to use variables for requesting chaining.

Thanks Allen, I will try Chaining, just checking how about setting the respective value as a global variable (for example) and export the global to a file. Later import the global into the next collection run. What do you think about this approach?

Oh ok, I didn’t understand that’s what you were trying to do.

If you are giving is a local file, you can use the flag --export-globals to overwrite it with the values after the collection run.

So your command would be

newman run myCollection.json --globals globals.json --export-globals globals.json

Here is the documentation for newman command line arguments