{"id":4021,"date":"2021-01-03T06:56:40","date_gmt":"2021-01-03T06:56:40","guid":{"rendered":"https:\/\/codethataint.com\/blog\/?p=4021"},"modified":"2021-01-05T17:03:23","modified_gmt":"2021-01-05T17:03:23","slug":"wiremock-interview-questions","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/wiremock-interview-questions\/","title":{"rendered":"Wiremock Interview Questions"},"content":{"rendered":"<ol>\n<li><strong>Wiremock Intro?<\/strong>\n<ul>\n<li>Serves canned responses to particular requests (stubbing), and that captures incoming requests so that they can be checked later (verification).<\/li>\n<li>External to application code which helps in the testing app in Dev and ST(System Testing) environment<\/li>\n<li>Helps in testing negative Scenarios like network latency<\/li>\n<li>Language Agnostic and production like testing<\/li>\n<\/ul>\n<\/li>\n<li><strong>How to differentiate Positive and Negative Scenarios?<\/strong><br \/>\n    It could be done based on method(GET, POST, DELETE, PUT), Path(\/employee, \/success) and based on Parameter.<\/p>\n<pre>\r\n GET \/employee?name=mugil\r\n       \r\n Method - GET\r\n Path   - \/employee\r\n Params - name       \r\n<\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/codethataint.com\/blog\/wp-content\/uploads\/2021\/01\/Wiremock1.jpg\" alt=\"\" \/>\n<\/li>\n<li><strong>How priority of Stub Response is selected when Paths overlap?<\/strong><br \/>\nStub is lowest no in priority would be selected.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t\/\/Priority 1\r\n\twireMockServer.stubFor(get(&quot;\/welcome&quot;)\r\n\t\t\t.atPriority(1)\r\n\t\t\t.willReturn(aResponse()\r\n\t\t        .withBody(&quot;Welcome with Priority 1&quot;)));\r\n\r\n\t\/\/Priority 2\r\n        wireMockServer.stubFor(get(&quot;\/welcome&quot;)\r\n\t\t.atPriority(2)\r\n                .willReturn(aResponse()\r\n                .withBody(&quot;Welcome with Priority 2&quot;)));\r\n<\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/codethataint.com\/blog\/wp-content\/uploads\/2021\/01\/Wiremock2.jpg\" alt=\"\" \/><\/p>\n<p><strong>Output<\/strong><\/p>\n<pre>\r\nWelcome with Priority 1\r\n<\/pre>\n<\/li>\n<li><strong>What is advantage of using Wiremock as Standalone?<\/strong>\n<ul>\n<li>Less dependency on Environment<\/li>\n<li>Useful for Load Testing<\/li>\n<li>Can be used by non JVM environment<\/li>\n<li>Can run remotely<\/li>\n<\/ul>\n<\/li>\n<li><strong>What are possible defects which could happen in application?<\/strong>\n<ol>\n<li>Timeout<\/li>\n<li>Server Error<\/li>\n<li>Invalid Response<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Wiremock Intro? Serves canned responses to particular requests (stubbing), and that captures incoming requests so that they can be checked later (verification). External to application code which helps in the testing app in Dev and ST(System Testing) environment Helps in testing negative Scenarios like network latency Language Agnostic and production like testing How to differentiate&hellip; <a href=\"https:\/\/codethataint.com\/blog\/wiremock-interview-questions\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[328],"tags":[],"class_list":["post-4021","post","type-post","status-publish","format-standard","hentry","category-interview-questions-wiremock"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/4021","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=4021"}],"version-history":[{"count":5,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/4021\/revisions"}],"predecessor-version":[{"id":4033,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/4021\/revisions\/4033"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=4021"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=4021"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=4021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}