# I need to test the 2 variable values from response

**URL:** <https://community.postman.com/t/i-need-to-test-the-2-variable-values-from-response/27783>\
**Category:** Help Hub\
**Tags:** tests, response\
**Created:** [September 13, 2021, 12:57pm UTC](https://community.postman.com/t/i-need-to-test-the-2-variable-values-from-response/27783 "2021-09-13T12:57:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![science-physicist-30](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@science-physicist-30](https://community.postman.com/u/science-physicist-30)\
**Post date:** [September 13, 2021, 12:57pm UTC](https://community.postman.com/t/i-need-to-test-the-2-variable-values-from-response/27783/1 "2021-09-13T12:57:04Z")

</div>

**Your question may already have an answer on the community forum. Please search for related topics, and then read through the [guidelines](https://community.postman.com/t/about-the-just-getting-started-category/37) before creating a new topic.**

> Here’s an outline with best practices for making your inquiry.

_My question_:

I need to test the values of two different variables from the response.

_Details (like screenshots)_:

I write the test something like this, but it passes the test but it should fail the test as the name and slug are not same.

let name = response.name;

let slug = response.slug;

pm.test(“Name and Slug are same”, ()=\> {

```
    pm.expect(name).to.equal(slug);

```

});

_How I found the problem_:

_I’ve already tried_:

---

<div class="post-metadata">

**Author:** ![bpricilla](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/bpricilla/32/6511_2.png) [@bpricilla](https://community.postman.com/u/bpricilla)\
**Post date:** [September 13, 2021, 1:38pm UTC](https://community.postman.com/t/i-need-to-test-the-2-variable-values-from-response/27783/2 "2021-09-13T13:38:33Z")

</div>

@science-physicist-30 Welcome to the Community 🥳

I believe you are aware about parsing the response, without the response structure based on what you have provided I am suggesting as below:

```auto
 var response = pm.response.json();
let name = response.name;
let slug = response.slug;

pm.test("Name and Slug are same", function () {
   
    pm.expect(name).to.eql(slug);
});

```
