Skip to main content
Version: 2.0.0

Rust Sample Application

Introduction

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

Setup app

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

git clone https://github.com/keploy/samples-rust && cd samples-rust/gql-mongo

Using Keploy :

Keploy can be installed on Linux directly and on Windows with the help of WSL. Based on your system architecture, install the keploy latest binary release from here:-

Linux

  1. 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
Details
2. 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

Let's start the MongoDB Instance

docker-compose up -d

Capture testcase

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

Generate testcase

Go to the http://127.0.0.1:8080 and create some queries.

We will get the following output in our terminal

Test-case


Run the testcases

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

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

TestRun

Voila!! Our testcases has passed 🌟