(DEPRECATED) Tests Object in POSTMAN
A free video tutorial from Tejasvi Hegde
Test Automation Enthusiast
4.3 instructor rating • 7 courses • 29,622 students
Learn more from the full courseREST API Testing, Automation using POSTMAN
Learn many features of the POSTMAN REST client for testing Restful API's, file uploads, data driven testing & many more.
07:48:07 of on-demand video • Updated May 2020
- Capture Network Traffic by setting up Proxies
- Learn how to do multi-part File Uploads
- Perform data driven testing (create 1000 students with a click of a button)
- Learn how to send SOAP Requests using POSTMAN
- Integrate POSTMAN with NEWMAN & JENKINS
- Different types of Authentication (BASIC,OAUTH1.0,OAUTH2.0)
- Scripting in POSTMAN
English [Auto] I didn't know we have seen how some environment and the global properties can be created and retrieved with the help of the out of the box functions that are present in Postman. They also understood some properties related to the request as well as the response. Now let us learn how to actually add sections in placement so that we can pass or fail or test based on the assumption. So postman provides us with the test subject. So this test subject can be used to actually assert on certain request as well as response by amateurs and based on these assumptions. The test will pass or fail. So let me go ahead and add a few assertions. So first thing is check the status of the test has to pass. Then the state discord must be equal to two hundred. The way we provide discussion is it use a test subject and this will provide the description of what the session is doing. So in this case I would say taking the stand is called followed by an equal say. Now we need the value of the response. So in order to extract that we have that response good which the dictionary object and the key of this particular dictionary object is called. This will was the start Estcourt. Now you want to equate it with a particular value that is we know that the test will pass if the status quo has 200. So we use the quotes to cite followed by the expected result but just to hint that and let me suggest So if I exclude this request you see that the response came back. And also if you notice the test section we have one test that got excluded so sure you can see all the past the field test the skip once in Dargis we saw that the status quo is two 200 and so test pass. Similarly let me add another assertions that is this time in response. Why do you want to tick that particular about you and what I will do is I will check the response body if a particular value is present. So remember one thing that responds body is actually a string in Postman the Dessen that you get back here is not the same thing that is displayed here. That is the Dasen body. This particular object is accurate is Tringali. So just keep that in mind. Find this what I'm learning is I want to check you out and it's coming back so in Dallas we can actually check a particular lasting value within a string by using the harassment that dart Hans on here I'll provide the value of the string and let me to run this request or get. So we see that despatch because we have this particular order that the response other than these two assertions. Let me add a couple of additional assertions if you want. So this assertion will actually take a particular response or their value. This will check the request matter and this should be taking the value of the response time. So this would actually take if the response time is less than 1 second. So this is nothing but this is expression milliseconds that is all the time that you get in post-merge is all in milliseconds so thousand milliseconds is not one second. So now if I run this request we should see in the section how fight fighters not up with the other passing let me just fail a test. But what's really expected state is good to and this time we see a failure to see for it or to fight bust. And one of them failed to remember one thing unless you assertion Boseman will not know whether a request passed or fail. So you can do if your request is failing when you run the collection and that you will never see the testis failed because unless you add assertions everything will just look good and look in Postman. So as an example if I just remove all these assertions and if I execute this collection so does not does this there's no test here. Everything got passed like you know if there was a failure also it wouldn't have been parked here. So if you are running this in a Jenkin's RCN Bronwen you would never know that if the test is failing on Arto always trained and showed that you had associates using that subject and that the postman will know whether to pass or fail a test.