Best Tools/Open Source Libs

Stubby4j best tool for testing interactions with web services

Recently while searching for some tool for testing web services,I came across Stubby4j ,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 & behavior testing.

Image – Stubby4j Utility

Stubby4j has following advantages over other tools:

  1. You can simulate responses from real servers
  2. Allows invocation of service call for services which are not ready yet or in-accessible due to various reasons.
  3. Simulates support for different types of HTTP authentication.
  4. Enables delayed responses for performance and stability testing

Key features

  • Emulate external webservice in a SANDBOX for your application to consume over HTTP(S)
  • HTTP request verification and HTTP response stubbing
  • Regex support for dynamic matching on URI, query params, headers, POST payload (ie:. mod_rewrite in Apache)
  • Dynamic token replacement in stubbed response, by leveraging regex capturing groups as token values during HTTP request verification
  • Record & 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
  • Dynamic flows. Multiple stubbed responses on the same stubbed URI to test multiple application flows
  • Fault injection, where after X good responses on the same URI you get a bad one
  • Serve binary files as stubbed response content (images, PDFs. etc.)
  • Embed stubby4j to create a web service SANDBOX for your integration test suite

Why would a developer love it ?

  • Simulate responses from real server and don’t care (or cannot) to go over the network
  • Third party web service your application suppose to contract with is not ready yet
  • Verify that your code makes HTTP requests with all the required parameters and/or headers
  • Verify that your code correctly handles HTTP error codes
  • You want to trigger response from the server based on the request parameters over HTTP or HTTPS
  • Support for any of the available HTTP methods
  • Simulate support for different types of HTTP Authorizations: Basic, Bearer Token & others
  • Support for HTTP 30x redirects
  • Provide canned answers in your contract/integration tests
  • Enable delayed responses for performance and stability testing
  • Avoid to spend time coding for the above requirements
  • Concentrate on the task at hand

QA use cases stubby4j?

  • Specifiable mock responses to simulate page conditions without real data.
  • Ability to test polling mechanisms by stubbing a sequence of responses for the same URI
  • Easily swappable data config files to run different data sets and responses.
  • All-in-one stub server to handle mock data with less need to upkeep code for test generation

System requirements

  • version >= 4.0.0: Oracle JRE v1.8.0_60
  • version >= 3.0.0: Oracle JRE v1.7.0_76
  • version = 2.0.22: Oracle JRE v1.7.0_04
  • version < 2.0.22: Oracle JRE 1.6.0_65-b14-462

Quick start : https://github.com/azagniotov/stubby4j#quick-start-example

Quick Start

  1. Download the latest stubby4j version (the JAR archive).
  2. Create the following local YAML file:
-  request:
      method: GET
      url: /hello-world
 
   response:
      status: 200
      headers:
         content-type: application/json
      body: Hello World!
  • Execute the downloaded stubby JAR using command java -jar stubby4j-x.x.xx.jar -d <PATH_TO_YOUR_CREATED_LOCAL_YAML_FILE>
  • Navigate to http://localhost:8882/hello-world to get the stubbed response “Hello World!”
  • Navigate to stubby4j admin portal at http://localhost:8889/status to see what has been stubbed & other useful data

Like this post? Don’t forget to share it!

Summary
Article Name
Stubby4j flexible and configurable tool for testing interactions with web services
Description
Highly flexible and configurable tool for testing interactions of SOA applications with web services
Author
Publisher Name
upnxtblog
Karthik

Allo! My name is Karthik,experienced IT professional.Upnxtblog covers key technology trends that impacts technology industry.This includes Cloud computing,Blockchain,Machine learning & AI,Best mobile apps, Best tools/open source libs etc.,I hope you would love it and you can be sure that each post is fantastic and will be worth your time.

Share
Published by
Karthik
Tags: stubby4j

Recent Posts

Finding the Right Time to Build Your Software Instead of Buy

There are few things as valuable to a business as well-designed software. Organizations today rely…

6 days ago

Innovators in Crypto: Prominent AI-Powered Coins

The cryptocurrency industry is being reshaped by the fusion of blockchain technology and artificial intelligence…

3 weeks ago

Top AI Design Tools Every Graphic Designer Should Use in 2024

Introduction Artificial Intelligence (AI) has also found its relevance in graphic design and is quickly…

2 months ago

Transforming Industries: The Integration of AI and Blockchain

Imagine a world where the brilliance of Artificial Intelligence (AI) meets the unbreakable security of…

2 months ago

How Can I Use Automation to Streamline My Digital Marketing Efforts?

In today’s fast-paced digital landscape, automation is not just a luxury but a necessity for…

2 months ago

Top 5 AI Technologies Transforming the Casino Gaming Landscape in 2025

The world of casino gaming has leveraged the emerging technology advancements to create immersive and…

3 months ago

This website uses cookies.