Welcome to Keploy π
Keploy
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. π
Quick Start
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
Features
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.
Other Features
- 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.
How it works?
Keploy is added as a middleware to your application that captures and replays all network interaction served to application from any source.
Installation
Start keploy server
git clone https://github.com/keploy/keploy.git && cd keploy
docker-compose up
The UI can be accessed at http://localhost:8081
Helm chart
Keploy can also be installed to your your Kubernetes cluster using the Helm chart available here
Run Sample application
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
Start PostgreSQL instance
docker-compose up -d
Run the application
go run handler.go main.go
Generate testcases
To genereate testcases we just need to make some API calls. You can use Postman, Hoppscotch, or simply curl
1. Generate shortned url
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"
}
2. Redirect to original url from shortened url
curl --request GET \
--url http://localhost:8080/GuwHCgoQ
Integration with native Go test framework
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)
}
Run the testcases
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
Language Support
Need another language support? Please raise an issue or discuss on our slack channel
Resources
π€ FAQs
π΅οΈβοΈ Why Keploy
βοΈ Installation Guide
π Contribution Guide
Community Channels
We'd love to collaborate with you to make Keploy great. To get started:
π Our valuable Contributorsπ©βπ»π¨βπ» :
Thanks goes to these wonderful people (emoji key):