Compare two JSON responses with Postman

  Рет қаралды 23,045

Valentin Despa

Valentin Despa

Күн бұрын

Пікірлер: 43
@vdespa
@vdespa 4 жыл бұрын
👉 Want to learn more about Postman? Check my complete Postman online course. vdespa.com/courses/?q=KZbin
@snagananda696
@snagananda696 5 ай бұрын
Great video. The expected responses and requests using a json file with base 64 encoding was genius
@vdespa
@vdespa 5 ай бұрын
@@snagananda696 Thanks, glad it helped.
@a.v.sanchez9193
@a.v.sanchez9193 3 жыл бұрын
Thank you. This is tremendously helpful! I highly recommend this tutorial to anyone testing an api with a microservice architecture.
@vdespa
@vdespa 3 жыл бұрын
Thanks ☺️
@hugfil
@hugfil 4 ай бұрын
Great video, thanks. Can you tell me if the test passes in the case that the responses are identical but in a different order?
@rohithkumar9120
@rohithkumar9120 Жыл бұрын
Is there a way to validate the two response with dynamic change in values without delete?
@FiRese7eN
@FiRese7eN 4 жыл бұрын
Great videos dude. They are very helpful and clear! Thanks.
@vdespa
@vdespa 4 жыл бұрын
Thanks. I am glad they are useful!
@teleport96
@teleport96 4 жыл бұрын
Thanks for the video! Tell me please, where I can find documentation about "delete" word in the Tests section? Maybe there are other "functions" I can use because I see this way of deleting props from the response in Postman for the first time. Thank you in advance.
@vdespa
@vdespa 4 жыл бұрын
Thanks for watching. I forgot to mention: this is simply a Javascript functionality, has nothing to do with Postman itself.
@deboratoshiekohara2723
@deboratoshiekohara2723 3 жыл бұрын
@@vdespa Hello, first of all congrats! Awesome video. I was trying to find a documentation on the delete too, I was trying to use it here, however I keep receiving a TypeError: Cannot convert undefined or null to object, whereas if I comment the delete line I receive the response. Any thougts of what I am doing wrong? const response=pm.response.json(); delete response.headers['uomId','quantity','totalValue','tax','cost']; pm.globals.set("expectedResponse",response); console.log(btoa(pm.response.text()));
@vdespa
@vdespa 3 жыл бұрын
@@deboratoshiekohara2723 Hey Débora, thanks for your comment. Please check again your code. In the video i have shown you something else.
@dailylife1504
@dailylife1504 2 жыл бұрын
How can I show different values ​​of 2 responses?
@vdespa
@vdespa 2 жыл бұрын
I am not sure what you mean by that. Could you share more details?
@HaiderAli-cf8vj
@HaiderAli-cf8vj 2 жыл бұрын
Sir How to Get Body Data?????????
@HaiderAli-wt4jp
@HaiderAli-wt4jp 2 жыл бұрын
Sir, Plz Give me an Answer
@srida999
@srida999 Жыл бұрын
Thanks but I am looking for a tool/code that does comparison on the fly by taking runtime traffic(queries). My project cannot rely on canned queries, since queries change all the time. Any tips or advice appreciated. I plan to develop the code myself (2/3 on a 10 in coding), but if i can find some tips, that would help.
@vdespa
@vdespa Жыл бұрын
Have you looked into just defining a JSON schema to test the structure of the response?
@helpothers6751
@helpothers6751 2 жыл бұрын
Hi Valentin, I am storing one response data in an environment variable, and the same data I need to compare in multiple API responses, please help me here.
@vdespa
@vdespa 2 жыл бұрын
Did you manage to replicate the example I've shown in the video?
@helpothers6751
@helpothers6751 2 жыл бұрын
Some multi-array
@samroy4893
@samroy4893 2 жыл бұрын
Hi Valentine, could you please help me that how can we compare two JSON responses in which values of the Keys are same in both responses but "Key" names are different....for an example key is "workId" in one response and in other response key is "id" , but both key having the same value "2342" and there are 250 key pair values that we have to compare.....hope you help me out..thank you.. really appreciated!!!!!
@cva1119
@cva1119 2 жыл бұрын
Hi, how can we compare both responses irrespective of order of the elements
@vdespa
@vdespa 2 жыл бұрын
The test will still pass or fail. But if it fails, it will be hard to do a diff.
@michalisbelomatis3042
@michalisbelomatis3042 9 ай бұрын
@@vdespa You mean that we don't have to sort the JSON responses? If they are identical but not in the same order, the test will pass?
@ravinadhb9219
@ravinadhb9219 3 жыл бұрын
Hi Valentin very good explanation. I have a question here . How do we add extra Object to the response and send it as request body to another API Request
@vdespa
@vdespa 3 жыл бұрын
You save it to a Postman variable and reuse it in the next request.
@markthomas9641
@markthomas9641 2 жыл бұрын
Thanks, good video. I use a tool called DeltaJSON to compare JSON responses from Postman API. It has an API that I can use from my code as well.
@vdespa
@vdespa 2 жыл бұрын
Thanks for sharing!
@ranithomas3006
@ranithomas3006 3 жыл бұрын
Very good explanation Valentin. Is there any solution to compare with request body values and response body values of the other request?
@vdespa
@vdespa 3 жыл бұрын
You can write assertions using pm.request and pm.response to get the data you need.
@blasterino
@blasterino 3 жыл бұрын
Hi Valentin, thank you very much for your videos they are very useful. As a tip to compare I use sublime text + filediffs plugin. I have a doubt, how would I delete a field if I don't have headers like args or data as your example json has. Thanks in advance
@vdespa
@vdespa 3 жыл бұрын
Thanks for sharing! You can use the delete keyword on any property of an object.
@blasterino
@blasterino 3 жыл бұрын
Thank for you qickly response
@Eswar1234eswar
@Eswar1234eswar 3 жыл бұрын
Thank you very much.
@vdespa
@vdespa 3 жыл бұрын
You're welcome ☺️
@JC-ov8ko
@JC-ov8ko 3 жыл бұрын
I use VS code to compare files locally so I am not exposing any important data. Also it color codes the differences.
@vdespa
@vdespa 3 жыл бұрын
Thanks for the tip, good idea!
@ranimolthomas717
@ranimolthomas717 3 жыл бұрын
Hi Valentin , It is very useful topic and Nice presentation. I faced one issue. can you please help me. While comparing two response body, am getting the error like Response must be like v1 | AssertionError: expected { Object (isChildExist, doNotRelease, ...) } to deeply equal [ Array(1) ] , even if the boolean values are same ( isChildExist & doNotRelease has boolean value). How can solve this issue. I used this - pm.expect(responsev2).to.eql(responsev1);
@vdespa
@vdespa 3 жыл бұрын
It looks like you are comparing an object with an array.
@ranimolthomas717
@ranimolthomas717 3 жыл бұрын
@@vdespa Thank You
Data-driven testing with different data sets for each request
16:48
Valentin Despa
Рет қаралды 17 М.
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
OAuth 2.0 Authorization Flow using the Dropbox API and Postman
32:38
Valentin Despa
Рет қаралды 32 М.
Consumer-driven Contract Testing using Postman
30:47
Valentin Despa
Рет қаралды 32 М.
Learn JSON in 10 Minutes
12:00
Web Dev Simplified
Рет қаралды 3,3 МЛН
JSON Schema Validation: How to Validate JSON Schema with Postman?
11:50
The Testing Academy
Рет қаралды 105 М.
The TSConfig Cheat Sheet
5:36
Matt Pocock
Рет қаралды 39 М.
Run Postman Collections in Jenkins with Newman
35:35
Valentin Despa
Рет қаралды 21 М.
Avoid these 10 Beginner Mistakes in Postman
9:10
Valentin Despa
Рет қаралды 9 М.
Learn JSON Step-by-Step from Scratch
13:11
Automation Step by Step
Рет қаралды 112 М.
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН