Keploy as a Go testing framework
Keploy tests Go services by recording real HTTP and database traffic from a running binary, then replaying it as assertions. There are no interfaces to extract for mocking, no httptest.Server to stand up, and no sqlmock expectations to keep in sync with your queries.
keploy record -c "./orders-service"What Keploy gives a Go team
Any Go binary, unchanged
Keploy runs the binary you build and ship. net/http, Gin, Echo, Fiber, chi, and gRPC servers all record the same way, because interception happens at the socket rather than inside the router.
- Go 1.19 and above
- No build tag or test-only entrypoint
- Router and middleware choice is invisible
- HTTP and gRPC servers both supported
Why Go 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.
Testing Go: by hand, with testify + sqlmock, or with Keploy
testify and sqlmock need an interface to substitute and a query string to restate. Keploy captures outside the process, so concrete types stay concrete and no contract is written down twice.
Select any row for the full comparison, with code.
What you write for Go vs what Keploy records
All three produce the same assertion. Only the third still passes after the next refactor without anyone editing it.
Two fake types and two interfaces exist only for this test. Both encode a payload shape nothing checks against the real Postgres rows or Stripe response.
Idiomatic Go, and still two copies of every contract — the SQL string is duplicated and stripeStub() is a handler someone has to keep current by hand.
The SQL and the upstream response are recorded, not restated. Concrete types stay concrete because nothing in the binary had to become an interface.
Times are estimates for authoring one endpoint’s coverage from scratch, not measurements.
Go testing tools, compared
The options a team on Go actually reaches for, and where each one genuinely wins. Select a row for the full comparison.
Assessments reflect each tool’s documented behaviour, not benchmark measurements.
Record your Go app once, replay it forever
Keploy sits below your Go 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 Go service and captures the dependency calls it makes.
What Keploy mocks for Go, with zero config
7 of the 8 dependencies a typical Go service talks to are stubbed from the recording itself — no mock classes, no fixture files, no containers in CI.
- Auto-mocked
PostgreSQLView page
Postgres protocol under pgx and lib/pq
- Auto-mocked
MySQLView page
MySQL protocol under go-sql-driver/mysql
- Auto-mocked
MongoDBView page
MongoDB wire protocol under mongo-driver
- Auto-mocked
RedisView page
RESP under go-redis and redigo
- Auto-mocked
Apache KafkaView page
Kafka protocol under sarama and kafka-go
- Auto-mocked
gRPCView page
HTTP/2 framed calls from google.golang.org/grpc
- Outbound HTTPAuto-mocked
Outbound HTTP
Any net/http client or resty call
- Partial
Amazon S3
S3 REST API via aws-sdk-go-v2
Your first Go test suite in under five minutes
Every command below runs against your existing Go service. Nothing in your source tree changes.
1Install the Keploy CLI
A single binary. Nothing is added to go.mod, so your module graph is untouched.
curl -sSL https://keploy.io/install.sh | bash2Build and record
Build as normal, then hand the binary to Keploy instead of running it directly.
go build -o server ./cmd/serverkeploy record -c "./server"3Exercise your endpoints
Every request served while recording becomes a test case, with its database and HTTP calls captured alongside.
curl -X POST localhost:8080/orders/ord_1/confirm -H 'Content-Type: application/json' -d '{"paymentToken":"tok_123"}'4Replay in CI
Replay boots the binary against recorded mocks, so the job needs no service containers.
keploy test -c "./server" --delay 5
Ready to try it on your own Go service?
Works with the rest of your Go stack
Keploy records at the network layer, so framework and driver choices inside your Go app do not change how it captures traffic.
Gin
Recorded through the HTTP server — router choice is invisible to capture.
- Echo
Echo
Same capture path; middleware order does not affect recording.
gRPC
Unary and server-streaming calls are captured as HTTP/2 frames.
GORM
Queries are captured as the SQL emitted, not as ORM calls.
sqlc
Generated query code records identically — no expectations to restate.
Docker
Record inside a container or on the host; replay needs neither.
Testing the rest of your stack
- Databases
Keploy as a PostgreSQL testing framework
Record the Postgres frontend/backend protocol once and replay real result sets in tests — no container, no pg-mem, no schema to rebuild.
Read the guide - Databases
Keploy as a MySQL testing framework
Mock MySQL at the wire protocol instead of standing up a container or swapping in H2 — the rows your queries really returned, replayed.
Read the guide - Caches & Stores
Keploy as a Redis testing framework
Record RESP traffic once and replay real cache hits, misses, TTLs, and pipeline responses without a Redis server in CI.
Read the guide - Message Queues
Keploy as a Apache Kafka testing framework
Test producers and consumers against recorded broker exchanges — no embedded Kafka, no Testcontainers cluster, no flaky poll loops.
Read the guide - Cloud & Infra
Keploy as a gRPC testing framework
Record real gRPC exchanges over HTTP/2 and replay them as tests — no in-process stub server, no hand-written mock service implementation.
Read the guide - Databases
Keploy as a MongoDB testing framework
Mock MongoDB at the wire protocol — real documents, real BSON types, real aggregation results — without a mongod binary in CI.
Read the guide
Join our GlobalCommunity
Connect with developers worldwide. Follow updates, ask questions, share feedback, and ship faster with other Keploy builders.
“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