Code Monkey home page Code Monkey logo

keploy's Introduction

๐Ÿš€๐ŸŽ‰ Dive into Keploy! ๐ŸŽ‰๐Ÿš€

Ever seen a developer logo this snazzy? ๐Ÿ‘‡

๐ŸŽค Introducing Keploy ๐Ÿฐ

Keploy is a next-gen E2E testing tool that provides an easy way to capture and generate tests(KTests) and data-mocks(KMocks) from real API calls. It automatically generates mocks and stubs, making the testing process simpler and more efficient.

๐Ÿ”„ Merge KTests with your fave testing libraries to see that glorious combined test-coverage. ๐ŸŽญ KMocks are multi-talented โ€“ use 'em in existing tests, as server tests, or just to impress your friends!

Generate Test Case from API call

๐Ÿฐ Fun fact: Keploy uses itself for testing! Check out our swanky coverage badge: Coverage Status ย 

๐ŸŒ Language Support

From Go's gopher ๐Ÿน to Python's snake ๐Ÿ, we support:

Go Java NodeJS Python

๐ŸŽฉ How's the Magic Happen?

Our magical ๐Ÿง™โ€โ™‚๏ธ Keploy proxy captures and replays ALL(CRUD operations, including non-idempotent APIs) your app's network interactions.

Take a journey to How Keploy Works? to discover the tricks behind the curtain!

Generate Test Case from API call

๐Ÿ“˜ Get Schooled!

Become a Keploy pro with our Documentation.

๐Ÿ’– Let's Build Together!

Whether you're a newbie coder or a wizard ๐Ÿง™โ€โ™€๏ธ, your perspective is golden. Take a peek at our:

๐ŸŒˆ Contribution Guidelines

โค๏ธ Code of Conduct

๐ŸŒŸ Features

๐Ÿš€ Export, maintain, and show off tests and mocks!

Generate Test Case from API call

๐Ÿค Shake hands with popular testing frameworks โ€“ Go-Test, JUnit, Py-Test, Jest and more!

Generate Test Case from API call

๐Ÿ•ต๏ธ Detect noise with surgeon-like precision!

Filters noisy fields in API responses like (timestamps, random values) to ensure high quality tests.

๐Ÿ“Š Say 'Hello' to higher coverage!

Keploy ensures that redundant testcases are not generated.

Quick Installation

Using Binary ( Linux / WSL)

Keploy can be utilized on Linux natively and through WSL on Windows.

Download the Keploy Binary.

AMD Architecture

curl --silent --location "https://github.com/keploy/keploy/releases/latest/download/keploy_linux_amd64.tar.gz" | tar xz -C /tmp

sudo mkdir -p /usr/local/bin && sudo mv /tmp/keploy /usr/local/bin && keploy

ARM Architecture

curl --silent --location "https://github.com/keploy/keploy/releases/latest/download/keploy_linux_arm64.tar.gz" | tar xz -C /tmp

sudo mkdir -p /usr/local/bin && sudo mv /tmp/keploy /usr/local/bin && keploy

Capturing Testcases

To initiate the recording of API calls, execute this command in your terminal:

sudo -E keploy record -c "CMD_TO_RUN_APP"

For instance, if you're using a simple Golang program, the command would resemble:

sudo -E keploy record -c "go run main.go"

Running Testcases

To run the testcases and generate a test coverage report, use this terminal command:

sudo -E keploy test -c "CMD_TO_RUN_APP" --delay 10

For example, if you're using a Golang framework, the command would be:

sudo -E keploy test -c "go run main.go" --delay 10

Docker Installation

Keploy can be used on Linux & Windows through Docker.

Note: MacOS users please install Colima.

Creating Alias

To establish a network for your application using Keploy on Docker, follow these steps.

If you're using a docker-compose network, replace keploy-network with your app's docker_compose_network_name below.

docker network create keploy-network

Then, create an alias for Keploy:

alias keploy='sudo docker run --pull always --name keploy-v2 -p 16789:16789 --network keploy-network --privileged --pid=host -it -v "$(pwd)":/files -v /sys/fs/cgroup:/sys/fs/cgroup -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/keploy/keploy'

Recording Testcases and Data Mocks

Here are few points to consider before recording!

  • If you're running via docker compose, ensure to include the <CONTAINER_NAME> under your application service in the docker-compose.yaml file like this.
  • Change the network name (--network flag) from keploy-network to your custom network if you changed it above.
  • Docker_CMD_to_run_user_container refers to the Docker command for launching the application.

Utilize the keploy alias we created to capture testcases. Execute the following command within your application's root directory.

keploy record -c "Docker_CMD_to_run_user_container --network keploy-network" --containerName "<containerName>"

Perform API calls using tools like Hoppscotch, Postman, or cURL commands.

Keploy will capture the API calls you've conducted, generating test suites comprising testcases (KTests) and data mocks (KMocks) in YAML format.

Running Testcases

Now, use the keployV2 Alias we created to execute the testcases. Follow these steps in the root directory of your application.

When using docker-compose to start the application, it's important to ensure that the --containerName parameter matches the container name in your docker-compose.yaml file.

keploy test -c "Docker_CMD_to_run_user_container --network keploy-network" --containerName "<containerName>" --delay 20

Voilร ! ๐Ÿง‘๐Ÿปโ€๐Ÿ’ป We have the tests with data mocks running! ๐Ÿฐ๐ŸŽ‰

You'll be able to see the test-cases that ran with the results report on the console as well locally in the testReport directory.

๐Ÿค” Questions?

Reach out to us. We're here to help!

Slack LinkedIn YouTube Twitter

๐Ÿฒ The Challenges We Face!

  • Unit Testing: While Keploy is designed to run alongside unit testing frameworks (Go test, JUnit..) and can add to the overall code coverage, it still generates E2E tests.
  • Production Lands: Keploy is currently focused on generating tests for developers. These tests can be captured from any environment, but we have not tested it on high volume production environments. This would need robust deduplication to avoid too many redundant tests being captured. We do have ideas on building a robust deduplication system #27

โœจ Resources!

๐Ÿค” FAQs

๐Ÿ•ต๏ธโ€๏ธ Why Keploy

โš™๏ธ Installation Guide

๐Ÿ“– Contribution Guide

๐ŸŒŸ Hall of Contributors

keploy's People

Contributors

slayerjain avatar re-tick avatar gouravkrosx avatar charankamarapu avatar sarthak160 avatar nehagup avatar shivamsouravjha avatar sonichigo avatar pranshusrivastava avatar ayush7614 avatar ditsuke avatar aerowisca avatar pradhyuman-sharma avatar madhavsikka avatar edwinwalela avatar testwill avatar cassiozareck avatar unnati914 avatar skant7 avatar sreekesh93 avatar siddharth2798 avatar thunderboltsid avatar shivansh-yadav13 avatar iamskp99 avatar saumyabhushan avatar sanskritiharmukh avatar rajpratik71 avatar petergeorgas avatar pankhudib avatar khanjasir90 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.