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

How to Secure Your APIs: A Step-by-Step Guide

If you are software programming in the era of ‘digital first’, APIs (Application Programming Interfaces)…

2 days ago

How Hackers Can Attack Smartwatches

Smartwatches have changed the way we organize our daily lives. They not only keep us…

7 days ago

AI and Predictive Marketing: Reaching the Right Audience at the Right Time

You’ve been targeting people, developing interesting content and managing marketing campaigns. However, it appears that…

3 weeks ago

Wearable Tech: How Smartwatches Are Evolving

The world of wearable technology has been evolving at a rapid pace, with one of…

3 months ago

Looking Back at 2024: A Year of Innovation and Growth on Upnxtblog

As we wrap up 2024, it’s time to reflect on the incredible journey we’ve had…

4 months ago

Developing a Strong Disaster Recovery Plan for Your Business

Operating a business often entails balancing tight schedules, evolving market dynamics, and shifting consumer requirements.…

4 months ago

This website uses cookies.