# Assert more than one value

**URL:** <https://community.postman.com/t/assert-more-than-one-value/7947>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [September 23, 2019, 11:26am UTC](https://community.postman.com/t/assert-more-than-one-value/7947 "2019-09-23T11:26:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![himanshudwivedi1989](https://avatars.discourse-cdn.com/v4/letter/h/4bbf92/32.png) [@himanshudwivedi1989](https://community.postman.com/u/himanshudwivedi1989)\
**Post date:** [September 23, 2019, 11:26am UTC](https://community.postman.com/t/assert-more-than-one-value/7947/1 "2019-09-23T11:26:24Z")

</div>

Hi All

Can any one help me in below scenario.

Need to assert all values which is there in array.

Could you guys help me in this.

pm.test(“Testing multiple values” , function(){

var arr = [‘Value1’,‘Value2’,‘Value3’,‘Value4’];  
var x;  
for(x of arr){  
console.log(x);  
pm.expect(pm.response.text()).to.include(x);  
}  
});

I tried above code but not working getting ‘There was an error in evaluating the test script: SyntaxError: Unexpected token }’ Error.

---

<div class="post-metadata">

**Author:** ![singhsivcan](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/singhsivcan/32/1595_2.png) [@singhsivcan](https://community.postman.com/u/singhsivcan)\
**Post date:** [September 23, 2019, 5:38pm UTC](https://community.postman.com/t/assert-more-than-one-value/7947/2 "2019-09-23T17:38:15Z")

</div>

Hi @himanshudwivedi1989, can you try this:

```javascript
pm.test("Testing multiple values", function () {
  let arr = ['Value1', 'Value2', 'Value3', 'Value4'],
    responseText = pm.response.text();

  arr.forEach((x) => {
    pm.expect(responseText).to.include(x);
  });
});

```

---

<div class="post-metadata">

**Author:** ![himanshudwivedi1989](https://avatars.discourse-cdn.com/v4/letter/h/4bbf92/32.png) [@himanshudwivedi1989](https://community.postman.com/u/himanshudwivedi1989)\
**Post date:** [September 23, 2019, 6:10pm UTC](https://community.postman.com/t/assert-more-than-one-value/7947/3 "2019-09-23T18:10:01Z")

</div>

Hi Siv,

not working for me.  
Still same error.

---

<div class="post-metadata">

**Author:** ![singhsivcan](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/singhsivcan/32/1595_2.png) [@singhsivcan](https://community.postman.com/u/singhsivcan)\
**Post date:** [September 23, 2019, 6:15pm UTC](https://community.postman.com/t/assert-more-than-one-value/7947/4 "2019-09-23T18:15:40Z")

</div>

Could you share the screenshot of your complete test script?  
The error seems to be somewhere else.

---

<div class="post-metadata">

**Author:** ![himanshudwivedi1989](https://avatars.discourse-cdn.com/v4/letter/h/4bbf92/32.png) [@himanshudwivedi1989](https://community.postman.com/u/himanshudwivedi1989)\
**Post date:** [September 23, 2019, 6:45pm UTC](https://community.postman.com/t/assert-more-than-one-value/7947/5 "2019-09-23T18:45:25Z")

</div>

Hi Siv,

It is working fine now both the codes.  
yours as well as mine.  
Thanks for the help.

---

<div class="post-metadata">

**Author:** ![himanshudwivedi1989](https://avatars.discourse-cdn.com/v4/letter/h/4bbf92/32.png) [@himanshudwivedi1989](https://community.postman.com/u/himanshudwivedi1989)\
**Post date:** [September 23, 2019, 6:54pm UTC](https://community.postman.com/t/assert-more-than-one-value/7947/6 "2019-09-23T18:54:59Z")

</div>

Hi Siv,

Do you have any idea about how to read values from json file and store into json object as expected output so that i can assert this output with actual object.

Since i can’t put more than 1000 values in my test script , i have to put those values into a file and then read as json and assert against my response.

![image](https://us1.discourse-cdn.com/getpostman/original/2X/c/c0365636e289e83ca8e888ecabc40449f3de64fb.png)

like here my json values are less so i mentioned in there itself what if they are more than 1000 (which is in my case) how to deal with this scenario.

Regards  
Himanshu

---

<div class="post-metadata">

**Author:** ![vdespa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vdespa/32/2770_2.png) [@vdespa](https://community.postman.com/u/vdespa)\
**Post date:** [September 23, 2019, 6:55pm UTC](https://community.postman.com/t/assert-more-than-one-value/7947/7 "2019-09-23T18:55:32Z")

</div>

Did you try something like:

```auto
pm.expect(1).to.be.oneOf([1, 2, 3]); 

```

---

<div class="post-metadata">

**Author:** ![himanshudwivedi1989](https://avatars.discourse-cdn.com/v4/letter/h/4bbf92/32.png) [@himanshudwivedi1989](https://community.postman.com/u/himanshudwivedi1989)\
**Post date:** [September 23, 2019, 6:56pm UTC](https://community.postman.com/t/assert-more-than-one-value/7947/8 "2019-09-23T18:56:58Z")

</div>

No i din’t try this one , but this will give you assert against single value i guess not all the values.

---

<div class="post-metadata">

**Author:** ![himanshudwivedi1989](https://avatars.discourse-cdn.com/v4/letter/h/4bbf92/32.png) [@himanshudwivedi1989](https://community.postman.com/u/himanshudwivedi1989)\
**Post date:** [September 23, 2019, 6:58pm UTC](https://community.postman.com/t/assert-more-than-one-value/7947/9 "2019-09-23T18:58:47Z")

</div>

tried with normal for loop.
