{"id":814,"date":"2017-11-27T07:00:45","date_gmt":"2017-11-27T01:30:45","guid":{"rendered":"http:\/\/www.upnxtblog.com\/?p=814"},"modified":"2017-11-26T18:50:21","modified_gmt":"2017-11-26T13:20:21","slug":"stubby4j-flexible-and-configurable-tool-for-testing-interactions-with-web-services","status":"publish","type":"post","link":"https:\/\/www.upnxtblog.com\/index.php\/2017\/11\/27\/stubby4j-flexible-and-configurable-tool-for-testing-interactions-with-web-services\/","title":{"rendered":"Stubby4j best tool for testing interactions with web services"},"content":{"rendered":"<div class='booster-block booster-read-block'><\/div><p>Recently while searching for some tool for testing web services,I came across\u00a0<a href=\"https:\/\/github.com\/azagniotov\/stubby4j\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Stubby4j<\/span><\/a><span style=\"font-weight: 400;\">\u00a0,it is highly flexible and configurable tool for testing interactions of SOA applications with web services (REST, SOAP, WSDL etc.) over HTTP(S) protocol. It is an actual HTTP server (stubby4j uses embedded Jetty) that allows stubbing of external systems with ease for integration, contract &amp; behavior testing.<\/span><\/p>\n<figure style=\"width: 240px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" loading=\"lazy\" src=\"https:\/\/camo.githubusercontent.com\/77510d9b2f34ba95138f3fabc5fa53292d880df4\/68747470733a2f2f63646e2e7261776769742e636f6d2f617a61676e696f746f762f737475626279346a2f6d61737465722f6173736574732f7374756262792d6c6f676f2d64756b652d686964696e672e737667\" alt=\"Stubb4j Utility\" width=\"240\" height=\"240\" \/><figcaption class=\"wp-caption-text\">Image &#8211; Stubby4j Utility<\/figcaption><\/figure>\n<p><span style=\"font-weight: 400;\">Stubby4j has following advantages over other tools:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">You can simulate responses from real servers<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Allows invocation of service call for services which are not ready yet or in-accessible due to various reasons.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Simulates support for different types of HTTP authentication.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Enables delayed responses for performance and stability testing<\/span><\/li>\n<\/ol>\n\n<h3><b>Key features<\/b><b><br \/>\n<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Emulate external webservice in a SANDBOX for your application to consume over HTTP(S) <\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">HTTP request verification and HTTP response stubbing <\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Regex support for dynamic matching on URI, query params, headers, POST payload (ie:. mod_rewrite in Apache) <\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Dynamic token replacement in stubbed response, by leveraging regex capturing groups as token values during HTTP request verification<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Record &amp; Replay. The HTTP response is recorded on the first call, having the subsequent calls play back the recorded HTTP response, without actually connecting to the external server<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Dynamic flows. Multiple stubbed responses on the same stubbed URI to test multiple application flows<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Fault injection, where after X good responses on the same URI you get a bad one<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Serve binary files as stubbed response content (images, PDFs. etc.)<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Embed stubby4j to create a web service SANDBOX for your integration test suite<\/span><\/li>\n<\/ul>\n<h3>Why would a developer love it ?<\/h3>\n<ul>\n<li>Simulate responses from real server and don&#8217;t care (or cannot) to go over the network<\/li>\n<li>Third party web service your application suppose to contract with is not ready yet<\/li>\n<li>Verify that your code makes HTTP requests with all the required parameters and\/or headers<\/li>\n<li>Verify that your code correctly handles HTTP error codes<\/li>\n<li>You want to trigger response from the server based on the request parameters over HTTP or HTTPS<\/li>\n<li>Support for any of the available HTTP methods<\/li>\n<li>Simulate support for different types of HTTP Authorizations: Basic, Bearer Token &amp; others<\/li>\n<li>Support for HTTP 30x redirects<\/li>\n<li>Provide canned answers in your contract\/integration tests<\/li>\n<li>Enable delayed responses for performance and stability testing<\/li>\n<li>Avoid to spend time coding for the above requirements<\/li>\n<li>Concentrate on the task at hand<\/li>\n<\/ul>\n<h3><a id=\"user-content-why-would-a-qa-use-stubby4j\" class=\"anchor\" href=\"https:\/\/github.com\/azagniotov\/stubby4j#why-would-a-qa-use-stubby4j\" aria-hidden=\"true\" target=\"_blank\" rel=\"noopener\"><\/a>QA use cases stubby4j?<\/h3>\n<ul>\n<li>Specifiable mock responses to simulate page conditions without real data.<\/li>\n<li>Ability to test polling mechanisms by stubbing a sequence of responses for the same URI<\/li>\n<li>Easily swappable data config files to run different data sets and responses.<\/li>\n<li>All-in-one stub server to handle mock data with less need to upkeep code for test generation<\/li>\n<\/ul>\n<h3><strong>System requirements\u00a0<\/strong><\/h3>\n<ul>\n<li style=\"font-weight: 400;\">version &gt;= 4.0.0: Oracle JRE v1.8.0_60<\/li>\n<li style=\"font-weight: 400;\">version &gt;= 3.0.0: Oracle JRE v1.7.0_76<\/li>\n<li style=\"font-weight: 400;\">version = 2.0.22: Oracle JRE v1.7.0_04<\/li>\n<li style=\"font-weight: 400;\">version &lt; 2.0.22: Oracle JRE 1.6.0_65-b14-462<\/li>\n<\/ul>\n<p>Quick start :\u00a0<a href=\"https:\/\/github.com\/azagniotov\/stubby4j#quick-start-example\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/azagniotov\/stubby4j#quick-start-example<\/a><\/p>\n<h3>Quick Start<\/h3>\n<ol>\n<li>Download the <a href=\"http:\/\/search.maven.org\/#search%7Cga%7C1%7Cg%3A%22io.github.azagniotov%22%20AND%20a%3A%22stubby4j%22\" target=\"_blank\" rel=\"noopener\">latest stubby4j version<\/a> (the JAR archive).<\/li>\n<li>Create the following local YAML file:<\/li>\n<\/ol>\n<div class=\"highlight highlight-source-yaml\">\n<pre>-  <span class=\"pl-ent\">request<\/span>:\r\n      <span class=\"pl-ent\">method<\/span>: <span class=\"pl-s\">GET<\/span>\r\n      <span class=\"pl-ent\">url<\/span>: <span class=\"pl-s\">\/hello-world<\/span>\r\n \r\n   <span class=\"pl-ent\">response<\/span>:\r\n      <span class=\"pl-ent\">status<\/span>: <span class=\"pl-c1\">200<\/span>\r\n      <span class=\"pl-ent\">headers<\/span>:\r\n         <span class=\"pl-ent\">content-type<\/span>: <span class=\"pl-s\">application\/json<\/span>\r\n      <span class=\"pl-ent\">body<\/span>: <span class=\"pl-s\">Hello World!<\/span><\/pre>\n<\/div>\n<ul>\n<li>Execute the downloaded stubby JAR using command <code>java -jar stubby4j-x.x.xx.jar -d &lt;PATH_TO_YOUR_CREATED_LOCAL_YAML_FILE&gt;<\/code><\/li>\n<li>Navigate to <code>http:\/\/localhost:8882\/hello-world<\/code> to get the stubbed response &#8220;Hello World!&#8221;<\/li>\n<li>Navigate to stubby4j admin portal at <code>http:\/\/localhost:8889\/status<\/code> to see what has been stubbed &amp; other useful data<\/li>\n<\/ul>\n<p><em><strong>Like this post? Don\u2019t forget to share it!<\/strong><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently while searching for some tool for testing web services,I came across\u00a0Stubby4j\u00a0,it is highly flexible and configurable tool for testing interactions of SOA applications with web services (REST, SOAP, WSDL etc.) over HTTP(S) protocol. It is an actual HTTP server (stubby4j uses embedded Jetty) that allows stubbing of external systems with ease for integration, contract [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3],"tags":[134],"class_list":["post-814","post","type-post","status-publish","format-standard","hentry","category-new-tools","tag-stubby4j"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9fbQS-d8","jetpack-related-posts":[{"id":611,"url":"https:\/\/www.upnxtblog.com\/index.php\/2017\/10\/26\/hotjar-powerful-tool-reveals-online-behavior-voice-users\/","url_meta":{"origin":814,"position":0},"title":"Hotjar powerful tool that reveals the online behavior and voice of your users","author":"Karthik","date":"October 26, 2017","format":false,"excerpt":"Hotjar combines both Analysis and Feedback tools to provide \u2018big picture\u2019 of how to improve your site's user experience and performance (conversion rates).\u00a0The Analysis tools allow you to measure and observe user behavior (what users do) while the Feedback tools allow you to hear what your users have to say\u2026","rel":"","context":"In &quot;Best Tools\/Open Source Libs&quot;","block_context":{"text":"Best Tools\/Open Source Libs","link":"https:\/\/www.upnxtblog.com\/index.php\/category\/new-tools\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7944,"url":"https:\/\/www.upnxtblog.com\/index.php\/2025\/05\/05\/mutation-testing-explained-boost-software-quality-with-smarter-test-coverage\/","url_meta":{"origin":814,"position":1},"title":"Mutation Testing Explained: Boost Software Quality with Smarter Test Coverage","author":"Karthik","date":"May 5, 2025","format":false,"excerpt":"Ever looked at your test coverage numbers and thought, \u201cLooks great!\u201d but you still ended up with bugs in production? yes, you\u2019re not alone. The truth is, traditional test coverage tools can be misleading. They tell you what\u2019s been executed, not what\u2019s been tested well. That\u2019s where mutation testing comes\u2026","rel":"","context":"In &quot;Best Tools\/Open Source Libs&quot;","block_context":{"text":"Best Tools\/Open Source Libs","link":"https:\/\/www.upnxtblog.com\/index.php\/category\/new-tools\/"},"img":{"alt_text":"Illustration of software tests detecting and eliminating code bugs (mutants) in a development workflow.","src":"https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2025\/05\/QA-engineers-rafiki.png?fit=1200%2C1200&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2025\/05\/QA-engineers-rafiki.png?fit=1200%2C1200&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2025\/05\/QA-engineers-rafiki.png?fit=1200%2C1200&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2025\/05\/QA-engineers-rafiki.png?fit=1200%2C1200&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2025\/05\/QA-engineers-rafiki.png?fit=1200%2C1200&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":7352,"url":"https:\/\/www.upnxtblog.com\/index.php\/2023\/08\/25\/ultimate-guide-to-mobile-application-testing\/","url_meta":{"origin":814,"position":2},"title":"Ultimate Guide to Mobile Application Testing","author":"Karthik","date":"August 25, 2023","format":false,"excerpt":"The demand for mobile applications has increased over the years. However, delivering better experiences on mobile has become very challenging. That is why mobile application testing is a must for mobile apps before they reach the market. Besides, it helps build a secure and safe app by meeting all the\u2026","rel":"","context":"In &quot;Best Apps&quot;","block_context":{"text":"Best Apps","link":"https:\/\/www.upnxtblog.com\/index.php\/category\/best-new-apps\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2023\/08\/test-7620653_1280.png?fit=1200%2C858&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2023\/08\/test-7620653_1280.png?fit=1200%2C858&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2023\/08\/test-7620653_1280.png?fit=1200%2C858&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2023\/08\/test-7620653_1280.png?fit=1200%2C858&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2023\/08\/test-7620653_1280.png?fit=1200%2C858&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":6699,"url":"https:\/\/www.upnxtblog.com\/index.php\/2022\/01\/28\/how-test-automation-helps-in-avoiding-bugs-or-breaking-functionality\/","url_meta":{"origin":814,"position":3},"title":"How Test Automation Helps in Avoiding Bugs or Breaking Functionality?","author":"Karthik","date":"January 28, 2022","format":false,"excerpt":"An Overview of Automation Testing Services Test automation remains to be a popular term among quality assurance teams in an attempt to achieve quicker time to market, expand test coverage, and improve the efficiency of the test team. For test automation to be successful, a concentrated effort, as well as\u2026","rel":"","context":"In &quot;Trending&quot;","block_context":{"text":"Trending","link":"https:\/\/www.upnxtblog.com\/index.php\/category\/trending\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2022\/01\/How-Test-Automation-Helps.jpg?fit=800%2C400&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2022\/01\/How-Test-Automation-Helps.jpg?fit=800%2C400&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2022\/01\/How-Test-Automation-Helps.jpg?fit=800%2C400&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2022\/01\/How-Test-Automation-Helps.jpg?fit=800%2C400&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":7663,"url":"https:\/\/www.upnxtblog.com\/index.php\/2024\/02\/04\/integrating-ai-in-web-development-a-guide-for-php-and-wordpress-developers\/","url_meta":{"origin":814,"position":4},"title":"Integrating AI in Web Development: A Guide for PHP and WordPress Developers","author":"Karthik","date":"February 4, 2024","format":false,"excerpt":"Introduction In the rapidly evolving world of web development, Artificial Intelligence (AI) has emerged as a transformative force, offering unprecedented opportunities for innovation, efficiency, and personalization. For PHP and WordPress developers, integrating AI technologies into their projects is not just a trend but a necessity to stay competitive. This guide\u2026","rel":"","context":"In &quot;Machine Learning Guides&quot;","block_context":{"text":"Machine Learning Guides","link":"https:\/\/www.upnxtblog.com\/index.php\/category\/machine-learning\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2022\/03\/resilience-ai.jpg?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2022\/03\/resilience-ai.jpg?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2022\/03\/resilience-ai.jpg?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2022\/03\/resilience-ai.jpg?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2022\/03\/resilience-ai.jpg?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":7887,"url":"https:\/\/www.upnxtblog.com\/index.php\/2024\/12\/20\/best-7-ai-tools-every-ui-ux-designer-should-know-about\/","url_meta":{"origin":814,"position":5},"title":"Best 7 AI Tools Every UI\/UX Designer Should Know About","author":"Karthik","date":"December 20, 2024","format":false,"excerpt":"62% of UX designers now use AI to enhance their workflows. Artificial intelligence (AI) rapidly advances the UI\/UX design field. Designers are now working more efficiently, artistically, and intelligently with the help of AI tools and technologies. Designers in a UI\/UX design company now approach their work more effectively with\u2026","rel":"","context":"In &quot;Best Tools\/Open Source Libs&quot;","block_context":{"text":"Best Tools\/Open Source Libs","link":"https:\/\/www.upnxtblog.com\/index.php\/category\/new-tools\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2024\/12\/UX-Designer-Should-Know-About.png?fit=1200%2C717&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2024\/12\/UX-Designer-Should-Know-About.png?fit=1200%2C717&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2024\/12\/UX-Designer-Should-Know-About.png?fit=1200%2C717&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2024\/12\/UX-Designer-Should-Know-About.png?fit=1200%2C717&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.upnxtblog.com\/wp-content\/uploads\/2024\/12\/UX-Designer-Should-Know-About.png?fit=1200%2C717&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.upnxtblog.com\/index.php\/wp-json\/wp\/v2\/posts\/814","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.upnxtblog.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.upnxtblog.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.upnxtblog.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.upnxtblog.com\/index.php\/wp-json\/wp\/v2\/comments?post=814"}],"version-history":[{"count":6,"href":"https:\/\/www.upnxtblog.com\/index.php\/wp-json\/wp\/v2\/posts\/814\/revisions"}],"predecessor-version":[{"id":1383,"href":"https:\/\/www.upnxtblog.com\/index.php\/wp-json\/wp\/v2\/posts\/814\/revisions\/1383"}],"wp:attachment":[{"href":"https:\/\/www.upnxtblog.com\/index.php\/wp-json\/wp\/v2\/media?parent=814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.upnxtblog.com\/index.php\/wp-json\/wp\/v2\/categories?post=814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.upnxtblog.com\/index.php\/wp-json\/wp\/v2\/tags?post=814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}