Keploy logo
Echo logo

Keploy as a Echo testing framework

Keploy tests Echo applications by recording real requests through the running server and every SQL or outbound call they trigger, then replaying both as assertions. There is no mock echo.Context to construct and no sqlmock expectation to restate.

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

What Keploy gives a Echo team

Any Echo app, unchanged

Keploy runs the binary you build. Route groups, custom middleware, and binder validation all execute because capture is at the socket rather than inside the Echo instance.

  • Echo v4 and above
  • Route groups and nested middleware
  • Bind and Validate run for real
  • No test-only echo.New()
The problem

Why Echo 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 Echo: by hand, with testify + httptest, or with Keploy

httptest serves into an Echo instance the test file builds, so middleware from main is missing. Keploy records the running binary, so the server under test is the one you deploy.

Select any row for the full comparison, with code.

Same coverage, three costs

What you write for Echo 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
handler_manual_test.go
hand-written
// Hand-written: a Context built here, not a request from main.
package api
 
func TestConfirmOrder(t *testing.T) {
e := echo.New()
// Note what is missing: the JWT and recover middleware main adds.
body := strings.NewReader(`{"paymentToken":"tok_123"}`)
req := httptest.NewRequest(http.MethodPost, "/", body)
req.Header.Set(echo.HeaderContentType, echo.MIMEApplicationJSON)
rec := httptest.NewRecorder()
c := e.NewContext(req, rec)
c.SetParamNames("id")
c.SetParamValues("ord_1")
 
if err := NewHandler(fakeRepo{}, fakePayments{}).Confirm(c); err != nil {
t.Fatal(err)
}
if rec.Code != 200 {
t.Fatalf("got %d, want 200", rec.Code)
}
}

The Context is fabricated, path params are set by hand, and no middleware ran — so an unauthorised or unregistered route passes here.

testify + httptest1–2 hours
handler_sqlmock_test.go
tool-assisted
// testify + sqlmock + an httptest stub upstream.
package api
 
func TestConfirmOrder(t *testing.T) {
db, mock, _ := sqlmock.New()
defer db.Close()
 
// The query now lives in two places.
mock.ExpectQuery("SELECT id, amount_minor, state FROM orders").
WithArgs("ord_1").
WillReturnRows(sqlmock.NewRows([]string{"id", "amount_minor", "state"}).
AddRow("ord_1", 4200, "NEW"))
 
upstream := httptest.NewServer(stripeStub())
defer upstream.Close()
 
rec := serve(t, NewRepo(db), NewPayments(upstream.URL))
 
assert.Equal(t, 200, rec.Code)
assert.NoError(t, mock.ExpectationsWereMet())
}

Fast and idiomatic — and the SQL string is duplicated while stripeStub() is a handler someone has to keep current by hand.

With Keploy~5 minutes
test-1.yaml
auto-generated
# Recorded with: keploy record -c './orders-api'
# Nobody wrote this file. Keploy captured it from a real request.
version: api.keploy.io/v1beta1
kind: Http
name: test-1
spec:
req:
method: POST
url: /orders/ord_1/confirm
header:
Authorization: Bearer <captured>
body: '{"paymentToken":"tok_123"}'
resp:
status_code: 200
body:
id: "ord_1"
state: "CONFIRMED"
amountMinor: 4200
noise:
- body.confirmedAt
mocks:
- kind: Postgres
operation: "SELECT id, amount_minor, state FROM orders WHERE id = $1"
- kind: Http
url: https://api.payments.example.com/v1/payment_intents/tok_123/confirm

The recorded case travelled the real middleware chain from main, so the JWT check and the binder both ran on the way to this response.

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

Keploy vs the alternatives

Echo 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.

Best in classStrongPartialNot covered

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

How it works

Record your Echo app once, replay it forever

Keploy sits below your Echo 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 Echo service and captures the dependency calls it makes.

Echo logo
Your Echo app
GET/api/v1/orders/{id}200
RecordingKeploy proxyeBPF · userspace
+3 more Echo dependencies
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.
Mock coverage

What Keploy mocks for Echo, with zero config

7 of the 7 dependencies a typical Echo service talks to are stubbed from the recording itself — no mock classes, no fixture files, no containers in CI.

Quick start

Your first Echo test suite in under five minutes

Every command below runs against your existing Echo 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-api"
  3. 3Exercise the paths you care about

    Build as normal, then drive the binary. Every request becomes a test case with its SQL and HTTP calls captured alongside.

    go build -o orders-api ./cmd/api
    curl -X POST localhost:8080/orders/ord_1/confirm -H 'Content-Type: application/json' -H 'Authorization: Bearer $TOKEN' -d '{"paymentToken":"tok_123"}'
  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-api" --delay 6

Ready to try it on your own Echo service?

Ecosystem

Works with the rest of your Echo stack

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

FAQ

Echo 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.