0

I wrote a script in the test tab to set an access token from the login request. After setting access token I want to call logout API to revoke my session or access token.

I have mentioned .setNextRequest("Requestname" i.e logout) and logout request also included in that folder.

When I run all the folders in the collection runner, I get success to call login request and set access token but my .setNextRequest() method is not working where I am passing the request name.

If we have to pass request ID then I am unable to identify request ID within that folder. Any useful suggestion would be appreciated.

Here is my script in the test tab of the login request.

var Jasondata = JSON.parse(responseBody);
var accessToken = Jasondata.payload.accessToken;
console.log(accessToken);

pm.environment.set("accessToken", accessToken);
postman.setNextRequest("7");
Danny Dainton
  • 23,069
  • 6
  • 67
  • 80
  • Where does the `7` come into what you're doing? Why can't you add the logout request name to the method...`postman.setNextRequest("logout");`. I'm finding it difficult to understand what's _not_ happening here. – Danny Dainton Aug 22 '19 at 14:17
  • @DannyDainton Firstly i did pass request name like "logout" but i didnt work then it came to my knowledge we can also pass request ID as Request name Butt in both case i got fialed. I dont understand whats the matter if ia m passing wrong wrong request ID i am unable to identify actual request ID according to collection sequence – AfzaalQALhr Aug 23 '19 at 07:18
  • What does 'It didn't work' mean? That _could_ mean lots of different things. Any errors? Are you sure you saved it after making the change. If you changed something in the tab and didn't save it, the runner isn't aware of that change. – Danny Dainton Aug 23 '19 at 08:20
  • @DannyDainton wow its worked after saving. Cool man Thanks – AfzaalQALhr Aug 23 '19 at 12:14

0 Answers0