A couple of examples are clearing the environment or perhaps you want to set a response as a variable to be used for other requests. Pre-request Script: These are the scripts you want to happen before you send the request.Otherwise, an error may occur and the collection will not compile properly. Make sure the body is written using proper syntax. Body: Certain methods will require you to enter parameters, most likely written in Javascript.Headers: Headers are the value pairs that you'll need to make the request functional.Params: You may need to use these parameters to filter the results you desire.I'll go over them very briefly as each organization will have APIs that utilize these differently. There are many tabs in the request window that you may need to utilize when testing endpoints.Importing a Collection or Individual Request If you get a 500, there's a chance you just found a bug. Know which errors you would expect if you're logged out, if data was created, deleted, etc. Knowing HTTP status response codes is incredibly useful. For example, know when to GET, POST, PATCH, or DELETE. With the integration of Newman, you will be able to have your Postman collections kicked off automatically through backend automation.Īre you using a RESTful API? These HTTP methods are useful to know for any dev or software QA role. Postman is not only a manual API testing tool. This link has been useful in my efforts to integrate and automate my tests through Jenkins CI pipelines. Newman allows you to run your Postman collections directly through the command line. I've personally used Game of Thrones API and Cat Facts for my own API education. This extensive list of publically available APIs is for those of you who don't have an API to call their own. There are many snippets here that I have incorporated into my own tests. These are some additional Chai.js examples. This guide demonstrates how user-friendly Chai.js can be. Learning the syntax to this assertion library has vastly improved the complexity of my tests. This is a definite must-read.Ĭhai.js is an assertion library that comes baked into Postman. For some, it might be the only resource they need. This is probably the best, most comprehensive, Postman reference guide I have found. I have provided several links to the sites that I found to be the most informational for my purposes as well as some Postman basics to get started with. I never found a single source of truth that I exclusively relied on. It became a sort of thought experiment to figure out the cheat sheet that I would have liked to inherit on my first day of the job. When I started to instruct my coworkers on the nuances of Postman, I realized there had to be others new to API testing or even new to software testing who would also benefit from these lessons. Postman was much easier to use and more versatile than the internally developed tools I had used in the past. I started to use Postman at that company, and I immediately fell in love with it. Not having rigid documentation to dictate the right or wrong way to do things became one of the most rewarding experiences I've had working in tech. I had just become the first API-centric QA at a startup, and I found the opportunity of establishing standard operating procedures both rewarding and thrilling. The Response also contains the Cookies, Headers and Test Results.Importing a Collection or Individual Request The following screen will appear − Preview tab The Preview tab shows the preview of the page. The Raw format displays the same data displayed in the Pretty tab but without any color or indentation. The Pretty format shows color formatting for keywords and indentation for easy reading. The Response Body contains the sub−tabs − Pretty, Raw and Preview. On hovering over the payload size, the details on the size of response, headers, Body, and so on are displayed. On hovering over the response time, we can see the time taken by different events like DNS Lookup, SSL Handshake and so on. Also, information on the time consumed to complete the request (223 ms) and payload size (20.75 KB) are populated. This signifies a successful request and a correct endpoint. Once a request has been sent, we can see the response code 200 OK populated in the Response. Step 4 − Enter an URL - in the address bar and click on Send. We shall then select the option GET from the HTTP request dropdown. Step 3 − The Request name (Test1) gets reflected on the Request tab. Enter the Request name then click on Save. Step 1 − Click on the New menu from the Postman application. Create a GET Requestįollow the steps given below to create a GET request successfully in Postman − The server only sends its Response to the request. The GET request does not update any server data while it is triggered. A GET request is used to obtain details from the server and does not have any impact on the server.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |