# Test .only.includes.all.keys(\[keys\])

**URL:** <https://community.postman.com/t/test-only-includes-all-keys-keys/32797>\
**Category:** Help Hub\
**Tags:** tests, json\
**Created:** [February 21, 2022, 3:50pm UTC](https://community.postman.com/t/test-only-includes-all-keys-keys/32797 "2022-02-21T15:50:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![bbahadur](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bbahadur](https://community.postman.com/u/bbahadur)\
**Post date:** [February 21, 2022, 4:20pm UTC](https://community.postman.com/t/test-only-includes-all-keys-keys/32797/2 "2022-02-21T16:20:41Z")

</div>

Hey @spacecraft-astronau2 👋 , Welcome to the community 🎊

I think what you are looking for, is to validate the property. You can use ‘.hasOwnProperty’ method to check for it:

```auto
//example
pm.test("Properties validated",()=>{
pm.expect(response.hasOwnProperty('a')).to.be.true;
pm.expect(response.hasOwnProperty('b')).to.be.true;
pm.expect(response.hasOwnProperty('c')).to.be.false;
// .....etc
})

```

If your response includes an array of data, have a look at this scenario:

> [@What is wrong with pm.expect](https://community.postman.com/t/what-is-wrong-with-pm-expect/29334/6):
>
> Hey @hasmukhpatel ! If you want to check if ‘data’ has all properties, you can iterate through each and perform assertion. Here is one way to achieve it: let jsonData = pm.response.json(); console.log(jsonData.data); pm.test("All keys present",()=\>{ \_.each(jsonData.data, (item)=\>{ pm.expect(item.hasOwnProperty('start\_date')).to.be.true; pm.expect(item.hasOwnProperty('score')).to.be.true; pm.expect(item.hasOwnProperty('unit')).to.be.true; pm.expect(item.hasOwnProperty('st…

Good luck 👍  
Hope it helps.

---

_[View the full topic](https://community.postman.com/t/test-only-includes-all-keys-keys/32797)._
