jeudi 16 août 2018

Update environment variable in Postman using Newman

I use the Newman and Postman software to testing website.

My construction looks like:

newman run "https://api.getpostman.com/collections/?apikey=“ --environment "https://api.getpostman.com/environments/?apikey=" --export-environment "https://api.getpostman.com/environments/?apikey=" --insecure

all works fine but my environment values don't update after the Newman running.

In my request, I use the next Pre-request Script to update the value:

var mail = pm.environment.get("mail_randomizer"); pm.environment.set("mail_randomizer", Number(mail) + 1);

After sending this request in Postman the value "mail_randomizer" is gone up by 1. But after running the Newman it doesn't work.

How can I export the environment correctly in Newman?

Aucun commentaire:

Enregistrer un commentaire