Skip to main content
Version: 2.0.0

Rust Sample Application


This is a sample app to test Keploy integration capabilities using rust and MongoDb. Buckle up, it's gonna be a fun ride! 🎢

🛠️ Platform-Specific Requirements for Keploy

Below is a table summarizing the tools needed for both native and Docker installations of Keploy on MacOS, Windows, and Linux:

Operating SystemWithout DockerDocker InstallationPrerequisites
MacOS MacOSNot SupportedSupportedDocker Desktop version must be 4.25.2 or above
Windows WindowsSupportedSupported- Use WSL wsl --install
- Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11
Linux LinuxSupportedSupportedLinux kernel 5.15 or higher

On MacOS and Windows, additional tools are required for Keploy due to the lack of native eBPF support.

Quick Installation

Let's get started by setting up the Keploy alias with this command:

 curl --silent -O -L && source

You should see something like this:

▀▓▓███▄ ▄▄ ▄ ▌
▄▌▌▓▓████▄ ██ ▓█▀ ▄▌▀▄ ▓▓▌▄ ▓█ ▄▌▓▓▌▄ ▌▌ ▓
▓█████████▌▓▓ ██▓█▄ ▓█▄▓▓ ▐█▌ ██ ▓█ █▌ ██ █▌ █▓
▓▓▓▓▀▀▀▀▓▓▓▓▓▓▌ ██ █▓ ▓▌▄▄ ▐█▓▄▓█▀ █▓█ ▀█▄▄█▀ █▓█
▓▌ ▐█▌ █▌

Keploy CLI

Available Commands:
example Example to record and test via keploy
generate-config generate the keploy configuration file
record record the keploy testcases from the API calls
test run the recorded testcases and execute assertions
update Update Keploy

--debug Run in debug mode
-h, --help help for keploy
-v, --version version for keploy

Use "keploy [command] --help" for more information about a command.

🎉 Wohoo! You are all set to use Keploy.

Get Started! 🎬

Setup app

Now that we have bun installed, we will setup our application.

git clone && cd samples-rust/CRUD-rust-mongo

Running App Locally on Linux/WSL 🐧

We will be using Docker compose to run Mongo on Docker container.

Let's start the MongoDB Instance

docker compose up -d

Capture testcase

sudo -E env PATH=$PATH keploy record -c 'cargo run'

Generate testcase

  1. Create Notes
curl --location 'http://localhost:8000/api/notes/' \
--header 'Content-Type: application/json' \
--data '{
"title": "You'\''ll learn how to build a CRUD API with FastAPI",
"content": "Fastapi is really easy to use",
"category": "FastAPI"

which will return

"status": "success",
"data": {
"note": {
"id": "6618fa20875aedcfe96e08ed",
"title": "You'll learn how to build a CRUD API with FastAPI",
"content": "Fastapi is really easy to use",
"category": "FastAPI",
"published": false,
"createdAt": "2024-04-12T09:08:48.686Z",
"updatedAt": "2024-04-12T09:08:48.686Z"
  1. Get Notes
curl --location 'http://localhost:8000/api/notes/6618fa20875aedcfe96e08ed'

This is how keploy terminal would look like: Testcase

Run the testcases

Now, let's run the keploy in test mode again:-

sudo -E env PATH=$PATH keploy test -c 'cargo run'

Voila!! Our testcases has passed 🌟