# How to verify result when sendNextRequest

**URL:** <https://community.postman.com/t/how-to-verify-result-when-sendnextrequest/15894>\
**Category:** Help Hub\
**Created:** [September 15, 2020, 4:50pm UTC](https://community.postman.com/t/how-to-verify-result-when-sendnextrequest/15894 "2020-09-15T16:50:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![CV-JigneshP](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@CV-JigneshP](https://community.postman.com/u/CV-JigneshP)\
**Post date:** [September 15, 2020, 4:50pm UTC](https://community.postman.com/t/how-to-verify-result-when-sendnextrequest/15894/1 "2020-09-15T16:50:37Z")

</div>

I am running sendNextRequest and try to set global variable with value and try to verify after running twice…

but each time value not verify

can anyone give example for that?

---

<div class="post-metadata">

**Author:** ![hannah.neil](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/hannah.neil/32/4477_2.png) [@hannah.neil](https://community.postman.com/u/hannah.neil)\
**Post date:** [September 17, 2020, 3:42am UTC](https://community.postman.com/t/how-to-verify-result-when-sendnextrequest/15894/2 "2020-09-17T03:42:41Z")

</div>

Hi @CV-JigneshP - welcome to the Postman Community! 🙂

Could you provide more details on your issue? Screenshots/code snippets can help us troubleshoot. What other solutions have you attempted so far?

---

<div class="post-metadata">

**Author:** ![CV-JigneshP](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@CV-JigneshP](https://community.postman.com/u/CV-JigneshP)\
**Post date:** [September 17, 2020, 4:04am UTC](https://community.postman.com/t/how-to-verify-result-when-sendnextrequest/15894/3 "2020-09-17T04:04:47Z")

</div>

i need a example for Chain tests together to create test suites in postman

how it’s work? and also when i use sendRequest into for loop it’s run once only…

i need a example for sendRequest in for loop

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [September 17, 2020, 11:40am UTC](https://community.postman.com/t/how-to-verify-result-when-sendnextrequest/15894/4 "2020-09-17T11:40:30Z")

</div>

Do you absolutely need to run sendRequest as a script?

Could you make the request a proper Postman request as part of your collection?

---

<div class="post-metadata">

**Author:** ![CV-JigneshP](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@CV-JigneshP](https://community.postman.com/u/CV-JigneshP)\
**Post date:** [September 17, 2020, 2:03pm UTC](https://community.postman.com/t/how-to-verify-result-when-sendnextrequest/15894/5 "2020-09-17T14:03:01Z")

</div>

Pre-request script:

var pPartids = pm.environment.get(“envPartids”);

var pQuantities = pm.environment.get(“envQuantities”);

if(!pPartids){

```
pPartids = [516,516];

```

}

if(!pQuantities){

```
pQuantities = [1,1];

```

}

pm.environment.set(“envPartids”,pPartids);

pm.environment.set(“envQuantities”,pQuantities);

Tests  
var pPartids = pm.environment.get(“envPartids”);

var pQuantities = pm.environment.get(“envQuantities”);

console.log(“pPartids length:”+pPartids.length);

var currentPartID = pPartids.shift();

var currentQuantity = pQuantities.shift();

console.log(currentPartID+currentQuantity)

pm.environment.set(“PartID”,currentPartID);

pm.environment.set(“Quantity”,currentQuantity);

var tpartids = pm.environment.get(“envPartids”);

console.log(“part length:”+tpartids.length);

for(var i=0;tpartids.length \> 0;i++)

{

```
console.log("i:"+i);

postman.setNextRequest("Verify User should able to add part into cart");

pm.test("Status code is 200 in add same part into cart", function () {

    pm.response.to.have.status(200);

});

var jsonData = JSON.parse(responseBody);

console.log("quantity: "+jsonData.Details[i].Quantity);

var currentPartID = pPartids.shift();

pm.environment.set("PartID",currentPartID);

pm.environment.set("envPartids",pPartids);

var currentQuantity = pQuantities.shift();

pm.environment.set("Quantity",currentQuantity);

pm.environment.set("envQuantities",pQuantities);

```

}

here is example

when i try above code it’s run only once…
