# Some value from Postman test undefined

**URL:** <https://community.postman.com/t/some-value-from-postman-test-undefined/40419>\
**Category:** Help Hub\
**Tags:** tests, variables, json\
**Created:** [October 25, 2022, 8:10am UTC](https://community.postman.com/t/some-value-from-postman-test-undefined/40419 "2022-10-25T08:10:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nhunter1](https://avatars.discourse-cdn.com/v4/letter/n/85f322/32.png) [@nhunter1](https://community.postman.com/u/nhunter1)\
**Post date:** [October 25, 2022, 8:10am UTC](https://community.postman.com/t/some-value-from-postman-test-undefined/40419/1 "2022-10-25T08:10:53Z")

</div>

I need to create tests in Postman for running key values for the AI Conversation app. I have created tests where I have used the logic below, where I can see all of the values after a test run except **actual\_cpid** For all values, I have used [https://jsonpathfinder.com/](https://jsonpathfinder.com/)

Postman doesn’t show this value in the result. Could you please help me figure out what I have missed? Thank you!

```auto
let jsonData = pm.response.json();
let utterance = jsonData.utterance;
let actual_intent = jsonData.intent.name;
let expected_intent = pm.variables.get("intent");
let actual_grammar = jsonData.grammars.speech_grammar;
let actual_cpid = jsonData.dialog_metadata.outgoing_data.data.CALLPURPOSE_ID;
let actual_dnis = jsonData.dialog_metadata.destination_uri;

tests[" ," + utterance + ", " + 
            expected_intent + ", " + 
            actual_intent + ", " + 
            actual_grammar + ", " +
            actual_cpid + ", " +
            actual_dnis + ", " +
            pm.environment.get("dialog_id")
            ] = true;

```

Thanks!

---

<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:** [October 25, 2022, 8:47am UTC](https://community.postman.com/t/some-value-from-postman-test-undefined/40419/2 "2022-10-25T08:47:41Z")

</div>

What are the reasons behind using the older `tests` object and not the `pm.test()` with the `pm.expect()` statements?

---

<div class="post-metadata">

**Author:** ![nhunter1](https://avatars.discourse-cdn.com/v4/letter/n/85f322/32.png) [@nhunter1](https://community.postman.com/u/nhunter1)\
**Post date:** [October 25, 2022, 8:59am UTC](https://community.postman.com/t/some-value-from-postman-test-undefined/40419/3 "2022-10-25T08:59:43Z")

</div>

I’m new to testing in Postman, it’s a way that has already existed in our team and it works.

---

<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:** [October 25, 2022, 9:02am UTC](https://community.postman.com/t/some-value-from-postman-test-undefined/40419/4 "2022-10-25T09:02:35Z")

</div>

To me, it’s strange when people have `pm.response.json()` and `pm.variables.get` in the same script and then don’t use `pm.test()` 😁

What’s the actual response that you’re trying to assert against?

---

<div class="post-metadata">

**Author:** ![nhunter1](https://avatars.discourse-cdn.com/v4/letter/n/85f322/32.png) [@nhunter1](https://community.postman.com/u/nhunter1)\
**Post date:** [October 25, 2022, 9:24am UTC](https://community.postman.com/t/some-value-from-postman-test-undefined/40419/5 "2022-10-25T09:24:05Z")

</div>

Can you help with the initial question?

---

<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:** [October 25, 2022, 9:40am UTC](https://community.postman.com/t/some-value-from-postman-test-undefined/40419/6 "2022-10-25T09:40:51Z")

</div>

I don’t know what the response body is that you’re testing against? The link you shared isn’t the response.

Sharing that would make it easier for others to help with a solution as they would know the structure of the data.

---

<div class="post-metadata">

**Author:** ![nhunter1](https://avatars.discourse-cdn.com/v4/letter/n/85f322/32.png) [@nhunter1](https://community.postman.com/u/nhunter1)\
**Post date:** [October 26, 2022, 4:15pm UTC](https://community.postman.com/t/some-value-from-postman-test-undefined/40419/7 "2022-10-26T16:15:10Z")

</div>

Thank you for your response, we have figurate out with a colleague where is was an issue.
