I need to test the 2 variable values from response

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines 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:

@science-physicist-30 Welcome to the Community :partying_face:

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

 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);
});