Skip to content

azagniotov/stubby4j

Repository files navigation

HTTP/1.1, HTTP/2 and WebSockets stub server for stubbing distributed web services in Docker and non-containerized environments for contract testing

CircleCI build master branch DockerHub GitHubStars GitHubForks codecov Maven Central Stackoverflow stubby4j

stubb4j

It is a highly flexible and configurable tool for testing interactions of service-oriented (SoA) or/and micro-services architectures (REST, SOAP, WSDL, etc.) over HTTP/1.1, HTTP/2 and WebSockets protocols.

Full documentation

pages-build-deployment say thanks!

Full documentation hosted at https://stubby4j.com, which includes a comprehensive user guide, various HOWTOs and usage examples.

Key features

There are a number of use cases where you'd want to use WebSockets, HTTP/1.1, HTTP/2 stub server in your development/QA environment. If you are a Software Engineer/Test Engneer/QA, then it should hit close to home with you. As an example, some of these use cases are outlined below (this is by no means an exhaustive list). Use stubby4j when you want to:

  • Dockerzied. Stub out external services in a Docker based micro-service architecture (ARM64 Docker images are also available!)
  • Support for TLS protocol versions 1.0, 1.1, 1.2 and 1.3
  • Support for HTTP/2 over TCP (h2c) and HTTP/2 over TLS (h2) on TLS v1.2 or newer using ALPN extension
  • Verify that your code makes HTTP/1.1 or HTTP/2 (over TLS) requests with all the required parameters and/or headers
  • Support for WebSocket protocol over HTTP/1.1 (with TLS and without) for request verification, response stubbing, server push, and more
  • Fault injection, where after X good responses on the same URI you get a bad one
  • Dynamic flows. Multiple stubbed responses on the same stubbed URI to test multiple application flows
  • Request proxying. Ability to configure a proxy/intercept where requests are proxied to another service
  • Record & Replay. The HTTP response recorded on the first call, having the subsequent calls play back the recorded HTTP response, without actually connecting to the external server
  • 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
  • Serve binary files as stubbed response content (images, PDFs. etc.)
  • Support for delayed responses for performance and stability testing
  • Support for HTTP 30x redirects verification
  • Support for different types of HTTP Authorizations: Basic, Bearer Token & others
  • Embed stubby4j to create a web service SANDBOX for your integration test suite
  • Verify that your code correctly handles HTTP response error codes

Full documentation hosted at https://stubby4j.com, which includes a comprehensive user guide, various HOWTOs and usage examples.

Minimal system requirements

Running stubby4j as a standalone JAR

See https://stubby4j.com/#minimal-system-requirements for more information.

Running stubby4j as a pre-built Docker container

See https://stubby4j.com/#running-in-docker for more information.

Docker Compose

See https://stubby4j.com/#docker-compose for more information.

Full documentation hosted at https://stubby4j.com, which includes a comprehensive user guide, various HOWTOs and usage examples.