server

module
v0.6.1-7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2022 License: Apache-2.0

README ΒΆ

Welcome to Keploy πŸ‘‹

contributions welcome Tests Go Report Card Slack Docs Gitpod

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   Coverage Status   without writing any test-cases and data-mocks. 😎 link-to-video-demo

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

Open in 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
Generate Test Case from API call

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.

Generate Test Case from API call

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?

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.

Read more in detail

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 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:

  • Slack - Discussions with the community and the team.
  • GitHub - For bug reports and feature requests.

Generic badge Generic badge Generic badge Generic badge

πŸ“Œ Our valuable ContributorsπŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» :

Thanks goes to these wonderful people (emoji key):


Shubham Jain

🚧

Sarthak

🚧

Ritik Jain

🚧

Neha Gupta

🚧

Felix-Ayush

🚧

Madhav Sikka

🚧

Unnati

🚧

Sid Shukla

🚧

Peter Georgas

🚧

Michael Grigoryan

🚧

Surya Kant

🚧

Mahesh Gupta

🚧

Naman Taneja

🚧

Rajat Sharma

🚧

Axit Patel

🚧

Tushar Malik

🚧

Launching keploy Rewards

Contributed to keploy? Here is a big thank you from our community to you. Claim your badge and showcase them with pride. Let us inspire more folks !

keploy Badges

Claim Now!

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL