# Not getting value of variable in test result

**URL:** <https://community.postman.com/t/not-getting-value-of-variable-in-test-result/14129>\
**Category:** Help Hub\
**Tags:** tests, variables\
**Created:** [July 14, 2020, 3:48pm UTC](https://community.postman.com/t/not-getting-value-of-variable-in-test-result/14129 "2020-07-14T15:48:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![svarshney2311](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@svarshney2311](https://community.postman.com/u/svarshney2311)\
**Post date:** [July 14, 2020, 3:48pm UTC](https://community.postman.com/t/not-getting-value-of-variable-in-test-result/14129/1 "2020-07-14T15:48:11Z")

</div>

pm.test(“Verify enabled field”, function () {  
pm.response.to.have.status(200);  
pm.expect(jsonData.data[0].isEnabled, "isEnabled value is not correct for **{{$(jsonData.data[0].sku)}}"** ).to.equal(pm.environment.get(“isEnabled”));

```auto
        }); 

```

I am not getting value of jsonData.data[0].sku in results if it fails. Could you please let me know what wrong am I doing?

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [July 14, 2020, 4:09pm UTC](https://community.postman.com/t/not-getting-value-of-variable-in-test-result/14129/2 "2020-07-14T16:09:34Z")

</div>

Hey @svarshney2311

I replied on the GH Issue you raised but not sure if you saw this yet.

I think something like this will work - I’m not clear on your response body so i’m unsure about the different references you have:

```auto
pm.test("Verify enabled field", function () {
    pm.response.to.have.status(200);
    pm.expect(jsonData.data[0].isEnabled, `isEnabled value is not correct for ${(jsonData.data[0].sku)}`).to.equal(pm.environment.get("isEnabled"));
});

```

---

<div class="post-metadata">

**Author:** ![svarshney2311](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@svarshney2311](https://community.postman.com/u/svarshney2311)\
**Post date:** [July 21, 2020, 8:26pm UTC](https://community.postman.com/t/not-getting-value-of-variable-in-test-result/14129/3 "2020-07-21T20:26:57Z")

</div>

Thanks Danny. It worked the way I wanted.
