FYI In 5:30 you told that to use jsonData.value. This works only for the response have only one Value. If response have multiple values with tag "Value" then you need to define like jsonData[0].value. Then only it will deeply pass the result.
Thank you for making API testing look so simple. In real world testing is this what we do when we say API testing or is there more to it, I mean advanced ways of testing the API?
Could you please take any web application and show some real time test cases or scenarios...also can you plz tell if this tutorial we can explain in interviews
Hi Pramod...This is really very helpful. But I want to know more about the writing the test cases as I am doing API testing first time. Please share more videos on advanced test case design.
ItsTechMode hi I want to learn how write tests in javascript..in postman. what are the things I need to learn as tester if I want write javascript tests in postman. please make video for example tests which can tests data integrity as well functionality of the api. thanks waiting for your reply.
Hi, All your videos are very helpful.. Can we compare the collection response with CSV data file? I want to compare string from response with CSV data e.g. this is my response { "testId": 11, "testCode": "BBHYMUNI", "testName": "API test postman user", } { } ........ I have CSV file with testId,testCode and testName How I can compare the response for multiple testname? I am able to compare testCode with following SNIPPET but testName is not working with same code var jsonData = pm.response.json(); pm.test("Your test name", function () { pm.expect(jsonData[data.index].testCode).to.eql(data.testCode); }) So please suggest how can I compare string
Hi Pramod...This is really very helpful. But I want to know more about the writing the test cases as I am doing API testing first time. i want to learn how to write test cases .
Hi I have found another way to validate x-total-count header value. But that is not in Snippet. Anyway thanks for you. Below is the code I used to validate x-total-count header value and it was passed for me. tests["x-total-count header present with value-->" + postman.getResponseHeader("x-total-count")] = postman.getResponseHeader("x-total-count");
Hello, I am new to api testing and I tried test cases. I am getting this format when I click on 'Status Code is 200' from the snippet - pm.test("Status code is 200", function () { pm.response.to.have.status(200); }); But you were getting completely different code snippet. Can you please help me on this how you got yours.
I am getting error message jsonData is undefined and my snippet is different from the one you show. Snippet: var schema = { "items": { "type": "boolean" } }; var data1 = [true, false]; var data2 = [true, 123]; pm.test('Schema is valid', function() { pm.expect(tv4.validate(data1, schema)).to.be.true; pm.expect(tv4.validate(data2, schema)).to.be.true; });
Hi, Iryna . Check the playlist for API Testing - ua-cam.com/play/PLr9tzW4-PrTatNwNb64xNIYq3Bd6OgRTy.html . I have tutorials on newman also. You can also check my website scrolltest.com
Hi Pramod, thanks for uploading this tutorial. This was very helpful to me. Quick question... In the portion where you explained how to test the value of a particular key in the response body. tests["User ID should be "] = jsonData.userId === 1; For such a test, say, if we have a lot of values to be validated. Then it'll be difficult to compare with a hard-coded value. So my question is, is it possible for me to do this comparison from some file (csv, txt etc) where I can store the values and provide the path to the file? Something like, tests["User ID should be "] = jsonData.userId === .; Appreciate your help.
+Biswajit Guha Hi I haven't tried it but I think if you have some sort Csv or text or json, try to require('data.csv') should work, let me try and get back to you.
Thanks buddy. I actually tried with a csv file last night. It works for a single fragment of api data. Like this... Save the test as a collection and then execute it through Runner. Create a csv data file which has first row defined as the keys and subsequent rows as data. Provide the path of the file in the Collection Runner. Postman provides an object called 'data' which we can used to parse the file. So the statement would look like... tests["User ID should be "] = jsonData.userId === data.userID;
Things get really messy when we have to use arrays. Let's say your user data is defined as an array of users. { "users": [ { "userId": 1, "id": 1, "title": "xyz" }, { "userId": 2, "id": 2, "title": "pqr" } ] } And the csv file has data as... userID,ID,Title 1,1,xyz 2,2,pqr The collection runner is just reading one row from the csv in each iteration. Therefore, the test passes for userId = 1, but fails for userId = 2, since the Runner has just parsed first row in the first iteration. tests["User ID should be "] = jsonData.users[0].userId === data.userID; Whereas, I need it to pick up both rows in a single iteration. Something like, tests["User ID should be "] = jsonData.users[0].userId === data[0].userID; tests["User ID should be "] = jsonData.users[1].userId === data[1].userID; But this approach doesn't work. 'data' does not take arrays.
I was actually hoping you'd have some solution to the 'data' object as array problem. :) Any idea how can I make the data object work as an array, or rather achieve parsing multiple rows from the datafile in a single iteration?
Good video, however, I think it's very important to get your tests to fail before assuming the positive test is enough.
We have been using it heavily in our company. It was just to explain a basic happy flow
FYI
In 5:30 you told that to use jsonData.value. This works only for the response have only one Value. If response have multiple values with tag "Value" then you need to define like jsonData[0].value. Then only it will deeply pass the result.
This was without a doubt one of the best video's I've seen on Postman... Subbing!
Really grateful for the uploads,as not many tutorials are available on Postman Tests !! Crisp and clear.
+Bharadwaj Pendyala Thanks for the feedback, stay tuned for some more advance concepts
Thanks for info which you have shared and very well explained
Very Nicely and with simplicity explained the use of Tests tab of postman, Liked it!! --Keep Rocking!
Thank you for making API testing look so simple. In real world testing is this what we do when we say API testing or is there more to it, I mean advanced ways of testing the API?
Your awesome. I’m a beginner and was struggling to write test condition. Your video clarified all my doubts. Great job bro.
Do you have any test plan template for integration testing
Could you please take any web application and show some real time test cases or scenarios...also can you plz tell if this tutorial we can explain in interviews
can we import these test cases in word or excel file?
Hi Pramod...This is really very helpful.
But I want to know more about the writing the test cases as I am doing API testing first time.
Please share more videos on advanced test case design.
+Shruti Lembhe You can get the latest post on my blog too, scrolltest.com
ItsTechMode hi I want to learn how write tests in javascript..in postman. what are the things I need to learn as tester if I want write javascript tests in postman. please make video for example tests which can tests data integrity as well functionality of the api. thanks waiting for your reply.
Hi,
All your videos are very helpful..
Can we compare the collection response with CSV data file?
I want to compare string from response with CSV data e.g.
this is my response
{ "testId": 11,
"testCode": "BBHYMUNI",
"testName": "API test postman user",
}
{
} ........
I have CSV file with testId,testCode and testName
How I can compare the response for multiple testname?
I am able to compare testCode with following SNIPPET but testName is not working with same code
var jsonData = pm.response.json();
pm.test("Your test name", function () {
pm.expect(jsonData[data.index].testCode).to.eql(data.testCode);
})
So please suggest how can I compare string
Very informative video!! Thanks!!
👏 good explanation for beginners
Hi Pramod...This is really very helpful.
But I want to know more about the writing the test cases as I am doing API testing first time.
i want to learn how to write test cases .
Check out my other tutorials , I hope that are helpful :)
Is there any way to validate x-total-count header value through code snippet? Which snippet should we use for header validations?
Export request to nodejs.org code and check in code that will work for sure
Oops I'm using my postman in Client PC. So I don't have access to install anything.
Hi I have found another way to validate x-total-count header value. But that is not in Snippet. Anyway thanks for you. Below is the code I used to validate x-total-count header value and it was passed for me.
tests["x-total-count header present with value-->" + postman.getResponseHeader("x-total-count")] = postman.getResponseHeader("x-total-count");
Hey You already explained it in 2:17. Open your header tab. I guess you can view x-total-count value as 1 for the response you shown in video.
Hello, I am new to api testing and I tried test cases. I am getting this format when I click on 'Status Code is 200' from the snippet - pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
But you were getting completely different code snippet. Can you please help me on this how you got yours.
Syntax is little changes but the logic is same. pm object is global and you can use the new and old one both
Thanks. How can I access response body. Response : { "id" : 44.
How can i check if 44 is there in response body?
pm.test("Your test name", function () {
var jsonData = pm.response.json();
pm.expect(jsonData.id).to.eql(44);
});
Response code: 200
ResponseMessage: ok
Response:
[{
Id :44,
Name:abc
Nooflicense:4
}]
From this how can i get 44. How to validate the response?
Thanks
At the run time which environment it will pick. can we make the environment dynamic at run time?
+Saurabh Mishra You can use newman command and pass the env.json at runtime depending upon your condition.
I am unable to connect MS SQL database with script in free version of POSTMAN. please suggest
I am getting error message jsonData is undefined and my snippet is different from the one you show.
Snippet:
var schema = {
"items": {
"type": "boolean"
}
};
var data1 = [true, false];
var data2 = [true, 123];
pm.test('Schema is valid', function() {
pm.expect(tv4.validate(data1, schema)).to.be.true;
pm.expect(tv4.validate(data2, schema)).to.be.true;
});
Heck your code again, probably missing some variable
No. Still same thing happening. When I do the same response you use same error message displayed. Which postman version you are using?
Hi ,When I using tiny schema valdation then getting error -ReferenceError: jsonData is not defined
Make sure this is present - var jsonData = pm.response.json();
hi. do you have lessons about newman? cli companion for postman
Hi, Iryna . Check the playlist for API Testing - ua-cam.com/play/PLr9tzW4-PrTatNwNb64xNIYq3Bd6OgRTy.html . I have tutorials on newman also. You can also check my website scrolltest.com
How about this ?
ua-cam.com/video/ky3H8RQwz68/v-deo.html
yes!!! wow, it what I need :) thanks.
simply superb.
any idea about POST or PUT. how do we pass the parameter at run time? put more lite on code snippet
+Saurabh Mishra You can pass the parameter in run time using environment or global variables check - g option in newman documentation.
But how can we use code snippet there on postman? as we see there on soapUI the descriptive programming
Email me - pramoddutta@live.com - Lets discuss it further :)
Hi Pramod, thanks for uploading this tutorial. This was very helpful to me.
Quick question...
In the portion where you explained how to test the value of a particular key in the response body.
tests["User ID should be "] = jsonData.userId === 1;
For such a test, say, if we have a lot of values to be validated. Then it'll be difficult to compare with a hard-coded value.
So my question is, is it possible for me to do this comparison from some file (csv, txt etc) where I can store the values and provide the path to the file? Something like,
tests["User ID should be "] = jsonData.userId === .;
Appreciate your help.
+Biswajit Guha Hi I haven't tried it but I think if you have some sort Csv or text or json, try to require('data.csv') should work, let me try and get back to you.
Thanks buddy. I actually tried with a csv file last night. It works for a single fragment of api data. Like this... Save the test as a collection and then execute it through Runner. Create a csv data file which has first row defined as the keys and subsequent rows as data. Provide the path of the file in the Collection Runner. Postman provides an object called 'data' which we can used to parse the file. So the statement would look like...
tests["User ID should be "] = jsonData.userId === data.userID;
Things get really messy when we have to use arrays. Let's say your user data is defined as an array of users.
{
"users": [
{
"userId": 1,
"id": 1,
"title": "xyz"
},
{
"userId": 2,
"id": 2,
"title": "pqr"
}
]
}
And the csv file has data as...
userID,ID,Title
1,1,xyz
2,2,pqr
The collection runner is just reading one row from the csv in each iteration. Therefore, the test passes for userId = 1, but fails for userId = 2, since the Runner has just parsed first row in the first iteration.
tests["User ID should be "] = jsonData.users[0].userId === data.userID;
Whereas, I need it to pick up both rows in a single iteration. Something like,
tests["User ID should be "] = jsonData.users[0].userId === data[0].userID;
tests["User ID should be "] = jsonData.users[1].userId === data[1].userID;
But this approach doesn't work. 'data' does not take arrays.
+Biswajit Guha Great
I was actually hoping you'd have some solution to the 'data' object as array problem. :)
Any idea how can I make the data object work as an array, or rather achieve parsing multiple rows from the datafile in a single iteration?
Good one.
How to sync postman and alm?
Haven't explore this dude sorry
How to convert test run output xl or csv workbooks?
How to solve Internal server error
Just Awesome
How to open console in windown 10 ?
www.lifewire.com/how-to-open-command-prompt-2618089
very nice !!!
Thanks )
please make next videos please
Sure , Let me know which all topic you would like to see.
Hi , I mean whole series of videos which talk about all the functions of postman how to test get requests with all other parameters. Thanks Mahesh
Hi, Can you please share how to test request using multiple data set ( not by using data file but by using code in pre scripts)