Keploy logo
Amazon SQS logo

Keploy as a Amazon SQS testing framework

Keploy mocks Amazon SQS by recording the AWS SDK's HTTP traffic, capturing sent message ids, received messages with their receipt handles, and delete acknowledgements, then replaying them in tests. No LocalStack runs, no queue exists, and no credentials are needed.

Generate Amazon SQS tests free
keploy record -c "./orders-worker"
18.4K+VS Code1.2M+300M+mocks created

What Keploy gives a Amazon SQS team

Captured at the SQS HTTP API

The AWS SDK talks to SQS over HTTPS, so Keploy records the real exchange — message bodies, attributes, receipt handles, and the long-poll response shape included.

  • Below every AWS SDK language binding
  • Receipt handles preserved
  • Message attributes captured
  • Long-poll responses recorded
The problem

Why Amazon SQS integration tests slow teams down

The friction is rarely the assertions. It is everything around them — spinning up dependencies, keeping mocks honest, and repairing tests after every refactor.

Three ways to do it

Testing Amazon SQS: by hand, with LocalStack SQS, or with Keploy

LocalStack gives a working SQS API in a container and leaves every consumer test long-polling. Keploy records the real service once and replays it instantly.

Select any row for the full comparison, with code.

Same coverage, three costs

What you write for Amazon SQS vs what Keploy records

All three produce the same assertion. Only the third still passes after the next refactor without anyone editing it.

By hand2–4 hours
fake_queue.py
hand-written
# Hand-written fake: no visibility timeout, no receipt handles.
class FakeQueue:
def __init__(self):
self.sent = []
 
def send(self, body, attributes=None):
# No message id, no marshalling, no queue attributes.
self.sent.append(body)
return {"MessageId": "fake"}
 
def receive(self, max_messages=1):
# No receipt handle, so the delete path is untestable.
return [{"Body": self.sent.pop(0)}] if self.sent else []

Without receipt handles there is nothing to delete, so the delete-after-processing path — where duplicate processing bugs live — cannot be tested.

LocalStack SQS1–2 hours
test_worker_localstack.py
tool-assisted
# LocalStack SQS: a container emulating the API.
import boto3, pytest
from testcontainers.localstack import LocalStackContainer
 
@pytest.fixture(scope="session")
def sqs():
with LocalStackContainer("localstack/localstack:3") as ls:
client = boto3.client("sqs", endpoint_url=ls.get_url())
client.create_queue(QueueName="orders")
yield client
 
def test_worker_processes_an_order(sqs):
url = sqs.get_queue_url(QueueName="orders")["QueueUrl"]
sqs.send_message(QueueUrl=url, MessageBody='{"id":"ord_1"}')
 
# Long polling: this is where the time goes.
msgs = sqs.receive_message(QueueUrl=url, WaitTimeSeconds=5)
 
assert Worker().handle(msgs["Messages"][0]) == "CONFIRMED"

Real API shape and receipt handles — and it needs a LocalStack container, a queue, and a five-second poll before the assertion.

With Keploy~5 minutes
mocks.yaml
auto-generated
# Recorded with: keploy record -c './orders-worker'
# The SQS exchange, captured at the HTTP API layer.
version: api.keploy.io/v1beta1
kind: Http
name: mock-3
spec:
request:
method: POST
url: https://queue.example.com/123456789012/orders
body: 'Action=ReceiveMessage&MaxNumberOfMessages=1&WaitTimeSeconds=20'
response:
status_code: 200
body:
Messages:
- MessageId: "b1f0-4c2a"
# The real handle, so the delete call replays too.
ReceiptHandle: "AQEB6nR8..."
Body: '{"id":"ord_1","state":"NEW"}'
MessageAttributes:
traceId: { StringValue: "9fk2mq", DataType: "String" }

The receipt handle is recorded, so the delete-after-processing call replays as a real exchange rather than being skipped.

Times are estimates for authoring one endpoint’s coverage from scratch, not measurements.

Keploy vs the alternatives

Amazon SQS testing tools, compared

The options a team on message brokers actually reaches for, and where each one genuinely wins. Select a row for the full comparison.

Best in classStrongPartialNot covered

Assessments reflect each tool’s documented behaviour, not benchmark measurements.

How it works

Record your Amazon SQS app once, replay it forever

Keploy sits below your Amazon SQS process at the network layer. It watches the calls your app already makes, then serves them back on replay so tests run with no dependencies attached.

Keploy records a GET call to /api/v1/orders/{id} on a Amazon SQS service and captures the dependency calls it makes.

Amazon SQS logo
Your Amazon SQS app
GET/api/v1/orders/{id}200
RecordingKeploy proxyeBPF · userspace
+2 more Amazon SQS clients
An example shape of a captured call. Your own endpoints and dependencies come from your real traffic, so nothing here has to be written by hand.
Quick start

Your first Amazon SQS test suite in under five minutes

Every command below runs against your existing Amazon SQS service. Nothing in your source tree changes.

  1. 1Install the Keploy CLI

    A single binary. It needs a Linux kernel with eBPF support, or Docker on macOS and Windows — and it adds nothing to your project's dependencies.

    curl -sSL https://keploy.io/install.sh | bash
  2. 2Record your service

    Pass the command you already use to start the app. Keploy runs it and watches every socket it opens.

    keploy record -c "./orders-worker"
  3. 3Exercise the paths you care about

    Send a message to your development queue and let the worker process it, so the receive, the processing, and the delete are all recorded.

    aws sqs send-message --queue-url $QUEUE_URL --message-body '{"id":"ord_1"}'
  4. 4Replay in CI

    Replay serves the recorded dependency responses, so the job needs no service containers and no Docker daemon.

    keploy test -c "./orders-worker" --delay 8

Ready to try it on your own Amazon SQS service?

Ecosystem

Works with the rest of your Amazon SQS stack

Keploy records at the network layer, so framework and driver choices inside your Amazon SQS app do not change how it captures traffic.

FAQ

Amazon SQS testing with Keploy: common questions

Join our GlobalCommunity

Connect with developers worldwide. Follow updates, ask questions, share feedback, and ship faster with other Keploy builders.

1.2M+Installs
18.4K+GitHub
100K+Devs
300M+Mocks
1K+Contributors
#1OSS Trending
4.9★★★★★from 500+ reviews onG2GartnerVS CodeChrome
★★★★★

Best report of integration and API tests I've seen — which we don't get from RestAssured.

G2
★★★★★

Future of microservices testing. I don't write tests now!

G2 · 5/5
★★★★★

An amazing product that simplifies the automation.

Gartner · 4.0
XGitHubSlackYouTubeLinkedIn
Built by developers, for developers.Let's build the future, together.