Hello, I have problem with comparing responses.
Right now I’m using something like below, but that only shows if responses are exactly the same.
In first response I use
pm.globals.set(‘response’, pm.response.json());
And in the second:
pm.test(‘Response the same as previous.’, () => {
pm.expect(pm.response.json()).to.deep.equal(pm.globals.get(‘response’));
});
Sadly in my project there are sometimes responses with different ordering, which according to PO is not an bug, so won’t be fixed. And that makes my tests fails.
Example what I need:
Lets say I have two json responses:
You could take a look at using the ChaiJS .deep.members() assertion?
I added this to the Tests tab to try it out under different scenarios (Object orders, Property ordering in the Object, Remove properties, Changing key/value names etc.)
I need the same thing. However I’m comparing two json with nested objects.
If I apply this on my json response I get "AssertionError: expected { Object (data, dictionaries) } to be an array " because it’s an object and not an array.