{"id":178,"date":"2018-11-11T19:07:03","date_gmt":"2018-11-11T19:07:03","guid":{"rendered":"http:\/\/holdentheriault.com\/blog\/?p=178"},"modified":"2018-11-11T19:25:54","modified_gmt":"2018-11-11T19:25:54","slug":"api-testing-google-postman","status":"publish","type":"post","link":"https:\/\/holdentheriault.com\/blog\/index.php\/2018\/11\/11\/api-testing-google-postman\/","title":{"rendered":"API Testing &#038; Google Postman"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Google has always been one of the leaders in the tech industry and although there are many different options when it comes to selecting the best API testing tool, Google\u2019s Postman still is at the top of my list and here is why.<\/span><\/p>\n<h1><span style=\"font-weight: 400;\">What is an API? <\/span><\/h1>\n<p><span style=\"font-weight: 400;\">Great question! So, in computer programming, an application programing interface (API) consists of a subset of definitions, communication protocols, and tools for building software.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Basically what this means is that a set of clearly defined methods of communication amongst various components. This could be a web-based system, Operating system, database system, computer hardware, or even a software library. <\/span><\/p>\n<p>&nbsp;<\/p>\n<h1><span style=\"font-weight: 400;\">What makes a \u201cGood\u201d API?<\/span><\/h1>\n<p><span style=\"font-weight: 400;\">A good API makes development easier. Think of it as the rock, or the foundation of a project. You need a solid base foundation and building blocks the piece together the end result, right? Same goes for API and programming.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h1><span style=\"font-weight: 400;\">What is Google Postman?<\/span><\/h1>\n<p><span style=\"font-weight: 400;\">Google Postman \u201cmakes API Development simple, developers use Developers use Postman to build modern software for the API-first world.\u201d<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Not only can Postman be used for developing an API, it can also be used for Testing an API.<\/span><\/p>\n<p><iframe loading=\"lazy\" title=\"Understanding the API Lifecycle: A Day in the Life of an API\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/VxY_cz0VQXE?start=63&#038;feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<h1><span style=\"font-weight: 400;\">Google Postman Features<\/span><\/h1>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-179\" src=\"https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.37.46-PM-1024x266.png\" alt=\"\" width=\"1024\" height=\"266\" srcset=\"https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.37.46-PM-1024x266.png 1024w, https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.37.46-PM-300x78.png 300w, https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.37.46-PM-768x200.png 768w, https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.37.46-PM.png 1430w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-180\" src=\"https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.38.49-PM-1024x331.png\" alt=\"\" width=\"1024\" height=\"331\" srcset=\"https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.38.49-PM-1024x331.png 1024w, https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.38.49-PM-300x97.png 300w, https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.38.49-PM-768x248.png 768w, https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.38.49-PM.png 1844w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<h3><span style=\"font-weight: 400;\">Postman\u2019s Tools Support Every Stage of the API Lifecycle. <\/span><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-181\" src=\"https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.39.32-PM-1024x563.png\" alt=\"\" width=\"1024\" height=\"563\" srcset=\"https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.39.32-PM-1024x563.png 1024w, https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.39.32-PM-300x165.png 300w, https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.39.32-PM-768x422.png 768w, https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.39.32-PM.png 1928w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<h3><span style=\"font-weight: 400;\">Postman Cost &#8211; FREE!<\/span><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-182 size-large\" src=\"https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.40.46-PM-1024x452.png\" alt=\"\" width=\"1024\" height=\"452\" srcset=\"https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.40.46-PM-1024x452.png 1024w, https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.40.46-PM-300x132.png 300w, https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.40.46-PM-768x339.png 768w, https:\/\/holdentheriault.com\/blog\/wp-content\/uploads\/2018\/11\/Screen-Shot-2018-11-11-at-1.40.46-PM.png 1846w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">The best thing about Postman is that it is completely free! I have used Postman for a few years now and have never had a problem with the Free version and have used Postman for testing multiple API\u2019s.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h1><span style=\"font-weight: 400;\">How can I use Google Postman for API Testing?<\/span><\/h1>\n<p><span style=\"font-weight: 400;\">Google postman can be used for API testing in a variety of different ways. For example, you can have a simple status check on a website\u2019s Url that runs on a <\/span><a href=\"https:\/\/www.getpostman.com\/docs\/postman\/monitors\/intro_monitors\"><span style=\"font-weight: 400;\">monitor schedule<\/span><\/a><span style=\"font-weight: 400;\"> and runs at the top of every hour, and can even notify you when a website is unreachable with the ability to check HTTP Status Codes.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">You can also test a REST API\u2019s response body to verify that the API is providing the expected request response. <\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span style=\"font-weight: 400;\">Example Postman Tests:<\/span><\/h3>\n<p><b>\/\/ Status Code Tests:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">if(tests[&#8220;Status code is OK\/200 and receiving a response as expected&#8221;] = responseCode.code === 200) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\/\/ Response Assertions\/Status Checks<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0pm.test(&#8220;Status code is OK&#8221;, function () {<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0pm.response.to.have.status(&#8220;OK&#8221;);});<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0pm.test(&#8220;Response time is less than 800ms&#8221;, function () {<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0pm.expect(pm.response.responseTime).to.be.below(800);});<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0pm.sendRequest(&#8220;https:\/\/postman-echo.com\/get&#8221;, function (err, response) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0console.log(response.json());});<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0pm.test(&#8220;Content-Type is present&#8221;, function () {<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0pm.response.to.have.header(&#8220;Content-Type&#8221;);});<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><b>\/\/ Error Checks:<\/b><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0pm.test(&#8220;Response should be okay to process&#8221;, function () { <\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0pm.response.to.not.be.error; <\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0pm.response.to.have.jsonBody(&#8220;&#8221;); <\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0pm.response.to.not.have.jsonBody(&#8220;error&#8221;); });<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><b>\/\/ Response Body Content Tests:<\/b><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0pm.test(&#8220;Response contains A String&#8221;, function () {<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0pm.expect(pm.response.text()).to.include(&#8220;ExpectedResponseStringHere&#8221;);});<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">The above Example is of possible Test Scripts that can be written to test API\u2019s using Postman. The Status Code Tests are testing that the response was Status Code 200 (Ok) and that the Response was received in less than 800ms\/0.8 seconds.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The Error checks are checking that the response should be okay to process and is a .json as expected.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">The final test is testing that a Specific String from the Response Body is included in the API\u2019s response.<\/span><\/p>\n<p><a href=\"https:\/\/www.getpostman.com\/docs\/v6\/postman\/scripts\/test_scripts\"><b>View Postman Test Scripts for more information<\/b><\/a><b>. <\/b><\/p>\n<h1><span style=\"font-weight: 400;\">Postman Review<\/span><\/h1>\n<p><span style=\"font-weight: 400;\">Overall I am incredibly happy with Postman and everything that it can do in terms of being able to Test an API. Postman has a fantastic UI and is easy to learn and use for beginners. With the ability to automate scheduled runs and checks on API\u2019s it makes testing easy and powerful. Postman\u2019s free option is all that is needed when testing an API. If you are new to API Testing, and wanting to get your feet wet, I strongly recommend you give Postman a try. <\/span><\/p>\n<h1><span style=\"font-weight: 400;\">Links: <\/span><\/h1>\n<h3><a href=\"https:\/\/www.getpostman.com\/apps\"><span style=\"font-weight: 400;\">Download Google Postman<\/span><\/a><\/h3>\n<p><a href=\"https:\/\/holdentheriault.com\/blog\/index.php\/2018\/11\/11\/api-testing-a-google-postman-tutorial\/\">A How-To test using Postman Tutorial<\/a><\/p>\n<h3><a href=\"https:\/\/learning.getpostman.com\/getting-started\"><span style=\"font-weight: 400;\">Getting Started with Google Postman<\/span><\/a><\/h3>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Google has always been one of the leaders in the tech industry and although there are many different options when it comes to selecting the&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/holdentheriault.com\/blog\/index.php\/2018\/11\/11\/api-testing-google-postman\/\">Continue reading<span class=\"screen-reader-text\">API Testing &#038; Google Postman<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,3,10],"tags":[],"class_list":["post-178","post","type-post","status-publish","format-standard","hentry","category-api","category-software-testing","category-software-development-tools","entry"],"_links":{"self":[{"href":"https:\/\/holdentheriault.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/178","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/holdentheriault.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/holdentheriault.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/holdentheriault.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/holdentheriault.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=178"}],"version-history":[{"count":2,"href":"https:\/\/holdentheriault.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/178\/revisions"}],"predecessor-version":[{"id":187,"href":"https:\/\/holdentheriault.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/178\/revisions\/187"}],"wp:attachment":[{"href":"https:\/\/holdentheriault.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/holdentheriault.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/holdentheriault.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}