Keploy is a no-code API testing platform that generates tests-cases and data-mocks from API calls.
Dependency-mocks are automatically generated with the recorded request/responses.
Keploy is testing itself with Β Β without writing any test-cases and data-mocks. π
The fastest way to start with Keploy is the Gitpod-hosted version. When you're ready, you can install locally or host yourself.
One-click deploy sample URL Shortener application sample with Keploy using Gitpod
Convert API calls from any source to Test-Case : Keploy captures all the API calls and subsequent network traffic served by the application. You can use any existing API management tools like Postman, Hoppscotch, Curl to generate test-case.
- Automatically Mocks Dependencies
- Safely Replays all CRUD operations
Native interoperability with popular testing libraries like go-test
. Code coverage will be reported with existing and Keploy recorded test cases and can also be integrated in CI pipelines/infrastructure.
- Accurate Noise Detection in responses like (timestamps, random values) to ensure high quality tests.
- Statistical deduplication ensures that redundant testcases are not generated. WIP (ref #27).
- Web Console to visually understand the results, update behaviour and share findings across your team.
Keploy is added as a middleware to your application that captures and replays all network interaction served to application from any source.
git clone https://github.com/keploy/keploy.git && cd keploy
docker-compose up
The UI can be accessed at http://localhost:8081
Keploy can also be installed to your Kubernetes cluster using the Helm chart available here
Demos using Echo/PostgreSQL and Gin/MongoDB are available here. For this example, we will use the Echo/PostgreSQL sample.
git clone https://github.com/keploy/samples-go && cd samples-go/echo-sql
go mod download
docker-compose up -d
go run handler.go main.go
To genereate testcases we just need to make some API calls. You can use Postman, Hoppscotch, or simply curl
curl --request POST \
--url http://localhost:8080/url \
--header 'content-type: application/json' \
--data '{
"url": "https://github.com"
}'
this will return the shortened url. The ts would automatically be ignored during testing because it'll always be different.
{
"ts": 1647802058801841100,
"url": "http://localhost:8080/GuwHCgoQ"
}
curl --request GET \
--url http://localhost:8080/GuwHCgoQ
You just need 3 lines of code in your unit test file and that's it!!π₯π₯π₯
import (
"github.com/keploy/go-sdk/keploy"
"testing"
)
func TestKeploy(t *testing.T) {
keploy.SetTestMode()
go main()
keploy.AssertTests(t)
}
Note: Before running tests stop the sample application
go test -coverpkg=./... -covermode=atomic ./...
this should show you have 74.4% coverage without writing any code!
ok echo-psql-url-shortener 5.820s coverage: 74.4% of statements in ./...
All of these can be visualised here - http://localhost:8081/testlist
Need another language support? Please raise an issue or discuss on our slack channel
π€ FAQs
π΅οΈβοΈ Why Keploy
βοΈ Installation Guide
π Contribution Guide
We'd love to collaborate with you to make Keploy great. To get started:
Thanks goes to these wonderful people (emoji key):