From 84eea95787f4f05d34698f6f327564ac0902fc32 Mon Sep 17 00:00:00 2001 From: Akella Srinivas Date: Tue, 27 Jan 2026 23:50:19 +0530 Subject: [PATCH 1/7] fix(docs): add FastHTTP Postgres sample run and test instructions Signed-off-by: Akella Srinivas --- docusaurus.config.js | 6 +- src/components/QuickStartList.js | 2 - .../quickstart/go-fasthttp-postgres.md | 100 ++++++++++++++---- 3 files changed, 79 insertions(+), 29 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index a309aa12b..8ca8c1614 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -17,11 +17,7 @@ module.exports = { favicon: "img/favicon.png", organizationName: "keploy", // Usually your GitHub org/user name. projectName: "docs", // Usually your repo name. - markdown: { - hooks: { - onBrokenMarkdownLinks: "warn", - }, - }, + onBrokenMarkdownLinks: "warn", plugins: [ function preloadFontPlugin() { return { diff --git a/src/components/QuickStartList.js b/src/components/QuickStartList.js index 17f9e6e03..021cf1081 100644 --- a/src/components/QuickStartList.js +++ b/src/components/QuickStartList.js @@ -149,7 +149,6 @@ const quickstarts = [ link: "/docs/quickstart/samples-mysql/#running-app-locally-on-linuxwsl-", }, - /* { title: "FastHttp + Postgres", language: "Go", @@ -158,7 +157,6 @@ const quickstarts = [ "A sample CRUD application to demonstrate how seamlessly Keploy integrates with FastHttp and Postgres.", link: "/docs/quickstart/samples-fasthttp/#using-docker-compose-", }, - */ { title: "FastHttp + Postgres", diff --git a/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md b/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md index 61667fe1a..6db14ce8a 100644 --- a/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md +++ b/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md @@ -37,28 +37,85 @@ This guide walks you through generating tests and DB mocks for a sample CRUD app git clone https://github.com/keploy/samples-go.git && cd samples-go/fasthttp-postgres go mod download ``` +We can run the application in two ways: -We'll be running our sample application right on Linux, but just to make things a tad more thrilling, we'll have the database (Postgres) chill on Docker. Ready? Let's get the party started! ๐ŸŽ‰ +1. Run with Docker +2. Run without Docker -#### Point the app to local Postgres +### Option 1: Run with Docker -Update the Postgres URL to `localhost:5432` in `app.go` (mentioned at line 21 in the sample). +#### Capture testcases: +```shell +keploy record -c "docker compose up" --container-name=fasthttp_app +``` -#### Start Postgres +Keep an eye out for the `-c` flag! It's the command charm to run the app. Whether you're using `docker compose up` or `go run main.go`, it's your call. -```bash -docker compose up postgres +If you're seeing logs that resemble the ones below, you're on the right track: + +Sample Keploy Record + +Alright! With the app alive and kicking, let's weave some test cases. Making some API calls! Postman, Hoppscotch, + +or even the classic curl - take your pick! + +Time to create some users and books: + +##### To genereate testcases we just need to make some API calls. You can use [Postman](https://www.postman.com/), [Hoppscotch](https://hoppscotch.io/), or simply `curl`: - + +###### 1. Post Requests +```shell +curl -X POST -H "Content-Type: application/json" -d '{"name":"Author Name"}' http://localhost:8080/authors ``` -#### Record with Keploy while running the app +```shell +curl -X POST -H "Content-Type: application/json" -d '{"title":"Book Title","author_id":1}' http://localhost:8080/books +``` +###### 2. Get Requests ```bash -go build -o app +curl -i http://localhost:8080/books ``` -### Lights, Camera, Record! ๐ŸŽฅ +#### Run captured tests: + +Now that we have our testcase captured, run the test file. + +```shell +keploy test -c "docker compose up" --container-name=fasthttp_app --delay 10 +``` +When all is said and done, your test results should look a little something like this: + +Sample Keploy Replay + +### Option 2: Run Without Docker + +> Note: This application requires the following database environment variables +> to be set in order to run correctly. +> +> Create a .env file in this directory with the following values: +> +> ```env +> DB_HOST=localhost +> DB_PORT=5432 +> DB_USER=postgres +> DB_PASSWORD=password +> DB_NAME=db +> ``` + +#### Start the Postgres container: ```bash +docker compose up -d postgres +``` + +### Build the Application +```bash +go build -o app +``` + +#### Capture testcases: +```shell keploy record -c "./app" ``` @@ -74,33 +131,32 @@ or even the classic curl - take your pick! Time to create some users and books: -### Generate traffic +> Note: The server would be running on http://localhost:8080 -#### Post Requests -```bash -curl -X POST -H "Content-Type: application/json" -d '{"name":"Author Name"}' http://localhost:8080/authors +##### To genereate testcases we just need to make some API calls. You can use [Postman](https://www.postman.com/), [Hoppscotch](https://hoppscotch.io/), or simply `curl`: - +###### 1. Post Requests +```shell +curl -X POST -H "Content-Type: application/json" -d '{"name":"Author Name"}' http://localhost:8080/authors ``` - -```bash +```shell curl -X POST -H "Content-Type: application/json" -d '{"title":"Book Title","author_id":1}' http://localhost:8080/books ``` -#### Get Request - +###### 2. Get Requests ```bash curl -i http://localhost:8080/books ``` -Look at you go! With a few simple API calls, you've crafted test cases with mocks! Peek into the Keploy directory and behold the freshly minted `test-1.yml` and `mocks.yml`. -### ๐Ÿƒโ€โ™€๏ธ Run the Tests! -Time to put it all to the test: +#### Run captured tests -```bash -keploy test -c "./app" --delay 5 +Now that we have our testcase captured, run the test file. + +```shell +keploy test -c "./app" --delay 10 ``` > That `--delay` flag? Just a little pause (in seconds) to let your app catch its breath before the test cases start rolling in. From 8ec64c2056146514451d98a142cd0a9a0945e306 Mon Sep 17 00:00:00 2001 From: Akella Srinivas Date: Tue, 27 Jan 2026 23:59:51 +0530 Subject: [PATCH 2/7] fix(docs): add FastHTTP Postgres sample run and test instructions Signed-off-by: Akella Srinivas --- docusaurus.config.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 8ca8c1614..a309aa12b 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -17,7 +17,11 @@ module.exports = { favicon: "img/favicon.png", organizationName: "keploy", // Usually your GitHub org/user name. projectName: "docs", // Usually your repo name. - onBrokenMarkdownLinks: "warn", + markdown: { + hooks: { + onBrokenMarkdownLinks: "warn", + }, + }, plugins: [ function preloadFontPlugin() { return { From 812d1062d2f3707639b2c60ad82fc5adfc5ab362 Mon Sep 17 00:00:00 2001 From: Akella Srinivas Date: Thu, 29 Jan 2026 23:36:09 +0530 Subject: [PATCH 3/7] fix(docs): add FastHTTP Postgres sample run and test instructions Signed-off-by: Akella Srinivas --- .../quickstart/go-fasthttp-postgres.md | 204 ++++++++++++------ 1 file changed, 136 insertions(+), 68 deletions(-) diff --git a/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md b/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md index 6db14ce8a..010d243b2 100644 --- a/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md +++ b/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md @@ -20,76 +20,140 @@ keyword: --- import InstallReminder from '@site/src/components/InstallReminder'; -import SectionDivider from '@site/src/components/SectionDivider'; import ProductTier from '@site/src/components/ProductTier'; +import SectionDivider from '@site/src/components/SectionDivider'; - +# Using Docker Compose ๐Ÿณ -# Running App Locally on Linux/WSL ๐Ÿง + -This guide walks you through generating tests and DB mocks for a sample CRUD app built with FastHttp and Postgres using Keploy. +A sample CRUD app to test Keploy integration capabilities using FastHttp and Postgres -### Clone the sample CRUD application ๐Ÿงช +### Clone a sample CRUD App ๐Ÿงช ```bash git clone https://github.com/keploy/samples-go.git && cd samples-go/fasthttp-postgres go mod download ``` -We can run the application in two ways: -1. Run with Docker -2. Run without Docker +### Lights, Camera, Record! ๐ŸŽฅ -### Option 1: Run with Docker +Fire up the application and Postgres instance with Keploy. Keep an eye on the two key flags: +`-c`: Command to run the app (e.g., `docker compose up`). -#### Capture testcases: -```shell -keploy record -c "docker compose up" --container-name=fasthttp_app -``` +`--container-name`: The container name in the `docker-compose.yml` for traffic interception. -Keep an eye out for the `-c` flag! It's the command charm to run the app. Whether you're using `docker compose up` or `go run main.go`, it's your call. +#### Capture the test case -If you're seeing logs that resemble the ones below, you're on the right track: +```bash +keploy record -c "docker compose up" --container-name "fasthttp_app" --build-delay 50 +``` -Sample Keploy Record +> `--build-delay` adds a buffer (in seconds) to allow images to build/pull and services to start before Keploy begins interception. If your services are already up, you can omit it. -Alright! With the app alive and kicking, let's weave some test cases. Making some API calls! Postman, Hoppscotch, +๐Ÿ”ฅ Challenge time! Generate some test cases. How? Just **make some API calls**. Postman, Hoppscotch or even curl - take your pick! -or even the classic curl - take your pick! +#### Generate a Test Case -Time to create some users and books: +```bash +curl --request POST \ +--url http://localhost:8080/authors \ +--header 'content-type: application/json' \ +--data '{"name":"Author Name"}' +``` -##### To genereate testcases we just need to make some API calls. You can use [Postman](https://www.postman.com/), [Hoppscotch](https://hoppscotch.io/), or simply `curl`: - +Here's a peek of what you get: -###### 1. Post Requests -```shell -curl -X POST -H "Content-Type: application/json" -d '{"name":"Author Name"}' http://localhost:8080/authors +```json +{"id": 1, "name": "Author Name"} ``` -```shell -curl -X POST -H "Content-Type: application/json" -d '{"title":"Book Title","author_id":1}' http://localhost:8080/books +๐ŸŽ‰ Woohoo! With a simple API call, you've crafted a test case with a mock! Dive into the Keploy directory and feast your eyes on the newly minted `test-1.yml` and `mocks.yml` + +```yaml +version: api.keploy.io/v1beta2 +kind: Http +name: test-1 +spec: + metadata: {} + req: + method: POST + proto_major: 1 + proto_minor: 1 + url: http://localhost:8080/authors + header: + Accept: "*/*" + Content-Length: "23" + Content-Type: application/json + Host: localhost:8080 + User-Agent: curl/7.68.0 + body: |- + {"name":"Author Name"} + body_type: "" + resp: + status_code: 201 + header: + Content-Type: application/json + body: '{"id": 1, "name": "Author Name"}' + body_type: "" + status_message: "" + proto_major: 0 + proto_minor: 0 + objects: [] + assertions: + noise: + - header.Date + created: 1696834280 ``` -###### 2. Get Requests +#### Fetch Books from App + ```bash -curl -i http://localhost:8080/books +curl --request GET --url http://localhost:8080/books ``` -#### Run captured tests: +Spotted the new test and mock files in your project? High five! ๐Ÿ™Œ -Now that we have our testcase captured, run the test file. +### Run Tests +Time to put things to the test ๐Ÿงช -```shell -keploy test -c "docker compose up" --container-name=fasthttp_app --delay 10 +```bash +keploy test -c "docker compose up" --container-name "fasthttp_app" --build-delay 50 --delay 10 ``` -When all is said and done, your test results should look a little something like this: -Sample Keploy Replay +> The `--delay` flag? Oh, that's just giving your app a little breather (in seconds) before the test cases come knocking. + +Final thoughts? Dive deeper! Try different API calls, tweak the DB response in the `mocks.yml`, or fiddle with the request or response in `test-x.yml`. Run the tests again and see the magic unfold!โœจ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ปโœจ + +### Wrapping it up ๐ŸŽ‰ + +Congrats on the journey so far! You've seen Keploy's power, flexed your coding muscles, and had a bit of fun too! Now, go out there and keep exploring, innovating, and creating! Remember, with the right tools and a sprinkle of fun, anything's possible.๐Ÿ˜Š๐Ÿš€ + +Happy coding! โœจ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ปโœจ + + + +--- + +# Running App Locally on Linux/WSL ๐Ÿง + + + +A sample CRUD app to test Keploy integration capabilities using FastHttp and Postgres -### Option 2: Run Without Docker + + +### Clone a sample CRUD App ๐Ÿงช + +```bash +git clone https://github.com/keploy/samples-go.git && cd samples-go/fasthttp-postgres +go mod download +``` + +We'll be running our sample application right on Linux, but just to make things a tad more thrilling, we'll have the database (Postgres) chill on Docker. Ready? Let's get the party started!๐ŸŽ‰ > Note: This application requires the following database environment variables > to be set in order to run correctly. @@ -104,71 +168,75 @@ When all is said and done, your test results should look a little something like > DB_NAME=db > ``` -#### Start the Postgres container: +#### ๐Ÿƒ Kickstart PostgresDB + +Let's breathe life into your Postgres container. A simple spell should do the trick: + ```bash docker compose up -d postgres ``` -### Build the Application +### ๐Ÿ“ผ Roll the Tape - Recording Time! + +First, build the application: + ```bash go build -o app ``` -#### Capture testcases: -```shell +Ready, set, record! Here's how: + +```bash keploy record -c "./app" ``` -Keep an eye out for the `-c` flag! It's the command charm to run the app. Whether you're using `go run main.go` or the binary path like `./app`, it's your call. +Keep an eye out for the `-c `flag! It's the command charm to run the app. Whether you're using `go run main.go` or the binary path like `./app`, it's your call. -If you're seeing logs that resemble the ones below, you're on the right track: +Alright, magician! With the app alive and kicking, let's weave some test cases. The spell? Making some API calls! Postman, Hoppscotch, or the classic curl - pick your wand. -Sample Keploy Record +#### Generate a Test Case -Alright! With the app alive and kicking, let's weave some test cases. Making some API calls! Postman, Hoppscotch, +โœจ A pinch of POST magic: -or even the classic curl - take your pick! +```bash +curl --request POST \ +--url http://localhost:8080/authors \ +--header 'content-type: application/json' \ +--data '{"name":"Author Name"}' +``` -Time to create some users and books: +And... voila! An Author entry appears: -> Note: The server would be running on http://localhost:8080 +```json +{"id": 1, "name": "Author Name"} +``` +Give yourself a pat on the back! With that simple spell, you've conjured up a test case with a mock! Explore the **Keploy directory** and you'll discover your handiwork in `test-1.yml` and `mocks.yml`. -##### To genereate testcases we just need to make some API calls. You can use [Postman](https://www.postman.com/), [Hoppscotch](https://hoppscotch.io/), or simply `curl`: - +Now, the real fun begins. Let's weave more spells! -###### 1. Post Requests -```shell -curl -X POST -H "Content-Type: application/json" -d '{"name":"Author Name"}' http://localhost:8080/authors -``` -```shell -curl -X POST -H "Content-Type: application/json" -d '{"title":"Book Title","author_id":1}' http://localhost:8080/books -``` +#### Fetch Books from App + +๐Ÿš€ Follow the URL road...! -###### 2. Get Requests ```bash -curl -i http://localhost:8080/books +curl --request GET --url http://localhost:8080/books ``` +Did you spot the new test and mock scrolls in your project library? Awesome! ๐Ÿ‘ +### Run Tests ๐Ÿ -#### Run captured tests +Ready to put your spells to the test? -Now that we have our testcase captured, run the test file. - -```shell +```bash keploy test -c "./app" --delay 10 ``` -> That `--delay` flag? Just a little pause (in seconds) to let your app catch its breath before the test cases start rolling in. - -When all is said and done, your test results should look a little something like this: - -Sample Keploy Replay - -Final thoughts? Dive deeper! Try different API calls, tweak the DB response in the `mocks.yml`, or fiddle with the request or response in `test-x.yml`. Run the tests again and see the magic unfold! +Final thoughts? Dive deeper! Try different API calls, tweak the DB response in the `mocks.yml`, or fiddle with the request or response in `test-x.yml`. Run the tests again and see the magic unfold! โœจ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ปโœจ ### Wrapping it up ๐ŸŽ‰ -Congrats on the journey so far! You've seen Keploy's power, flexed your coding muscles, and had a bit of fun too! Now, go out there and keep exploring, innovating, and creating! Remember, with the right tools and a sprinkle of fun, anything's possible +Congrats on the journey so far! You've seen Keploy's power, flexed your coding muscles, and had a bit of fun too! Now, go out there and keep exploring, innovating, and creating! Remember, with the right tools and a sprinkle of fun, anything's possible. ๐Ÿ˜Š๐Ÿš€ -Happy coding! โœจ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ปโœจ +Hope this helps you out, if you still have any questions, reach out to us . From c97057556520b6af13fe8b7b4aa2fb12bd1055f2 Mon Sep 17 00:00:00 2001 From: Akella Srinivas Date: Fri, 30 Jan 2026 00:16:56 +0530 Subject: [PATCH 4/7] fix(docs): add FastHTTP Postgres sample run and test instructions Signed-off-by: Akella Srinivas --- .../quickstart/go-fasthttp-postgres.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md b/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md index 010d243b2..b7b6dc430 100644 --- a/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md +++ b/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md @@ -53,6 +53,10 @@ keploy record -c "docker compose up" --container-name "fasthttp_app" --build-del > `--build-delay` adds a buffer (in seconds) to allow images to build/pull and services to start before Keploy begins interception. If your services are already up, you can omit it. +If you're seeing logs that resemble the ones below, you're on the right track: + +Sample Keploy Record + ๐Ÿ”ฅ Challenge time! Generate some test cases. How? Just **make some API calls**. Postman, Hoppscotch or even curl - take your pick! #### Generate a Test Case @@ -126,6 +130,10 @@ keploy test -c "docker compose up" --container-name "fasthttp_app" --build-delay > The `--delay` flag? Oh, that's just giving your app a little breather (in seconds) before the test cases come knocking. +When all is said and done, your test results should look a little something like this: + +Sample Keploy Replay + Final thoughts? Dive deeper! Try different API calls, tweak the DB response in the `mocks.yml`, or fiddle with the request or response in `test-x.yml`. Run the tests again and see the magic unfold!โœจ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ปโœจ ### Wrapping it up ๐ŸŽ‰ @@ -192,6 +200,10 @@ keploy record -c "./app" Keep an eye out for the `-c `flag! It's the command charm to run the app. Whether you're using `go run main.go` or the binary path like `./app`, it's your call. +If you're seeing logs that resemble the ones below, you're on the right track: + +Sample Keploy Record + Alright, magician! With the app alive and kicking, let's weave some test cases. The spell? Making some API calls! Postman, Hoppscotch, or the classic curl - pick your wand. #### Generate a Test Case @@ -233,6 +245,10 @@ Ready to put your spells to the test? keploy test -c "./app" --delay 10 ``` +When all is said and done, your test results should look a little something like this: + +Sample Keploy Replay + Final thoughts? Dive deeper! Try different API calls, tweak the DB response in the `mocks.yml`, or fiddle with the request or response in `test-x.yml`. Run the tests again and see the magic unfold! โœจ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ปโœจ ### Wrapping it up ๐ŸŽ‰ From 78bd363789fdea6b879e266e2699aa103e00e1d5 Mon Sep 17 00:00:00 2001 From: Akella Srinivas Date: Mon, 2 Feb 2026 22:32:39 +0530 Subject: [PATCH 5/7] fix(docs): add FastHTTP Postgres sample run and test instructions Signed-off-by: Akella Srinivas --- .../quickstart/go-fasthttp-postgres.md | 67 +++++++++++-------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md b/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md index b7b6dc430..e1c942ab8 100644 --- a/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md +++ b/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md @@ -23,7 +23,7 @@ import InstallReminder from '@site/src/components/InstallReminder'; import ProductTier from '@site/src/components/ProductTier'; import SectionDivider from '@site/src/components/SectionDivider'; -# Using Docker Compose ๐Ÿณ +# FastHTTP & Postgres Sample CRUD App @@ -31,6 +31,8 @@ A sample CRUD app to test Keploy integration capabilities using FastHttp and Pos +## Using Docker Compose + ### Clone a sample CRUD App ๐Ÿงช ```bash @@ -40,7 +42,8 @@ go mod download ### Lights, Camera, Record! ๐ŸŽฅ -Fire up the application and Postgres instance with Keploy. Keep an eye on the two key flags: +Start up the application and Keploy with a single command. Make sure to keep an eye on the two key flags: + `-c`: Command to run the app (e.g., `docker compose up`). `--container-name`: The container name in the `docker-compose.yml` for traffic interception. @@ -57,7 +60,9 @@ If you're seeing logs that resemble the ones below, you're on the right track: Sample Keploy Record -๐Ÿ”ฅ Challenge time! Generate some test cases. How? Just **make some API calls**. Postman, Hoppscotch or even curl - take your pick! +Make API calls using **cURL**, **Postman**, or **Hoppscotch**. +Keploy captures these requests to automatically generate test suites with test cases and data mocks. + #### Generate a Test Case @@ -74,7 +79,9 @@ Here's a peek of what you get: {"id": 1, "name": "Author Name"} ``` -๐ŸŽ‰ Woohoo! With a simple API call, you've crafted a test case with a mock! Dive into the Keploy directory and feast your eyes on the newly minted `test-1.yml` and `mocks.yml` +This API call generates a test case along with the required mocks. You can find the generated files in the Keploy directory, including `test-1.yml` and `mocks.yml`. + +You can continue by making additional API calls to generate more test cases. ```yaml version: api.keploy.io/v1beta2 @@ -118,27 +125,28 @@ spec: curl --request GET --url http://localhost:8080/books ``` -Spotted the new test and mock files in your project? High five! ๐Ÿ™Œ +After running this request, more new test and mock files will be generated in your project directory. + ### Run Tests -Time to put things to the test ๐Ÿงช +Time to run the testcases which were generated from the previous API calls.. ```bash keploy test -c "docker compose up" --container-name "fasthttp_app" --build-delay 50 --delay 10 ``` -> The `--delay` flag? Oh, that's just giving your app a little breather (in seconds) before the test cases come knocking. +> The `--delay` flag specifies the time (in seconds) Keploy waits before running the test cases after starting the application. When all is said and done, your test results should look a little something like this: Sample Keploy Replay -Final thoughts? Dive deeper! Try different API calls, tweak the DB response in the `mocks.yml`, or fiddle with the request or response in `test-x.yml`. Run the tests again and see the magic unfold!โœจ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ปโœจ +Final thoughts? Dive deeper! Try different API calls, tweak the DB response in the `mocks.yml`, or fiddle with the request or response in `test-x.yml`. Run the tests again and see the magic unfold! ### Wrapping it up ๐ŸŽ‰ -Congrats on the journey so far! You've seen Keploy's power, flexed your coding muscles, and had a bit of fun too! Now, go out there and keep exploring, innovating, and creating! Remember, with the right tools and a sprinkle of fun, anything's possible.๐Ÿ˜Š๐Ÿš€ +Congrats on the journey so far! You've seen Keploy's power, flexed your coding muscles, and had a bit of fun too! Now, go out there and keep exploring, innovating, and creating! Remember, with the right tools and a sprinkle of fun, anything's possible. Happy coding! โœจ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ปโœจ @@ -146,7 +154,7 @@ Happy coding! โœจ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ปโœจ --- -# Running App Locally on Linux/WSL ๐Ÿง +## Running App Locally on Linux/WSL ๐Ÿง @@ -161,7 +169,7 @@ git clone https://github.com/keploy/samples-go.git && cd samples-go/fasthttp-pos go mod download ``` -We'll be running our sample application right on Linux, but just to make things a tad more thrilling, we'll have the database (Postgres) chill on Docker. Ready? Let's get the party started!๐ŸŽ‰ +We'll be running our sample application right on Linux, but just to make things a bit more thrilling, We'll have our database (Postgres) running on Docker. > Note: This application requires the following database environment variables > to be set in order to run correctly. @@ -176,39 +184,43 @@ We'll be running our sample application right on Linux, but just to make things > DB_NAME=db > ``` -#### ๐Ÿƒ Kickstart PostgresDB +### Kickstart PostgresDB -Let's breathe life into your Postgres container. A simple spell should do the trick: +Let's start your Postgres container: ```bash docker compose up -d postgres + ``` +> The `-d` flag runs the PostgreSQL container in detached mode (in the background). + +This would start your postgres container which will be running on docker. -### ๐Ÿ“ผ Roll the Tape - Recording Time! +### Lights, Camera, Record! ๐ŸŽฅ -First, build the application: +#### First, build the application: ```bash go build -o app ``` -Ready, set, record! Here's how: +#### Capture the test case ```bash keploy record -c "./app" ``` -Keep an eye out for the `-c `flag! It's the command charm to run the app. Whether you're using `go run main.go` or the binary path like `./app`, it's your call. +The `-c` flag specifies the command used to run the application. You can use either `go run main.go` or the compiled binary (for example, `./app`). If you're seeing logs that resemble the ones below, you're on the right track: Sample Keploy Record -Alright, magician! With the app alive and kicking, let's weave some test cases. The spell? Making some API calls! Postman, Hoppscotch, or the classic curl - pick your wand. +With the application running successfully, you can begin generating test cases by making API calls using tools such as **cURL**, **Postman**, or **Hoppscotch**. #### Generate a Test Case -โœจ A pinch of POST magic: +A simple POST call: ```bash curl --request POST \ @@ -217,29 +229,28 @@ curl --request POST \ --data '{"name":"Author Name"}' ``` -And... voila! An Author entry appears: +An Author entry appears: ```json {"id": 1, "name": "Author Name"} ``` -Give yourself a pat on the back! With that simple spell, you've conjured up a test case with a mock! Explore the **Keploy directory** and you'll discover your handiwork in `test-1.yml` and `mocks.yml`. +This API call generates a test case along with the required mocks. You can find the generated files in the Keploy directory, including `test-1.yml` and `mocks.yml`. -Now, the real fun begins. Let's weave more spells! +You can continue by making additional API calls to generate more test cases. #### Fetch Books from App -๐Ÿš€ Follow the URL road...! ```bash curl --request GET --url http://localhost:8080/books ``` -Did you spot the new test and mock scrolls in your project library? Awesome! ๐Ÿ‘ +You should now see the newly generated test and mock files in your project directory. -### Run Tests ๐Ÿ +### Run Tests -Ready to put your spells to the test? +You are now ready to run the generated test cases. ```bash keploy test -c "./app" --delay 10 @@ -249,10 +260,10 @@ When all is said and done, your test results should look a little something like Sample Keploy Replay -Final thoughts? Dive deeper! Try different API calls, tweak the DB response in the `mocks.yml`, or fiddle with the request or response in `test-x.yml`. Run the tests again and see the magic unfold! โœจ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ปโœจ +Final thoughts? Dive deeper! Try different API calls, tweak the DB response in the `mocks.yml`, or fiddle with the request or response in `test-x.yml`. Run the tests again and see the magic unfold! ### Wrapping it up ๐ŸŽ‰ -Congrats on the journey so far! You've seen Keploy's power, flexed your coding muscles, and had a bit of fun too! Now, go out there and keep exploring, innovating, and creating! Remember, with the right tools and a sprinkle of fun, anything's possible. ๐Ÿ˜Š๐Ÿš€ +Congrats on the journey so far! You've seen Keploy's power, flexed your coding muscles, and had a bit of fun too! Now, go out there and keep exploring, innovating, and creating! Remember, with the right tools and a sprinkle of fun, anything's possible. Hope this helps you out, if you still have any questions, reach out to us . From 11b5faed7296847be5bebf4ad7f6ba4fc97b4d6e Mon Sep 17 00:00:00 2001 From: Akella Srinivas Date: Mon, 2 Feb 2026 23:04:20 +0530 Subject: [PATCH 6/7] fix(docs): add FastHTTP Postgres sample run and test instructions Signed-off-by: Akella Srinivas --- .../quickstart/go-fasthttp-postgres.md | 72 +++---------------- 1 file changed, 11 insertions(+), 61 deletions(-) diff --git a/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md b/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md index e1c942ab8..a66c53a34 100644 --- a/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md +++ b/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md @@ -27,13 +27,13 @@ import SectionDivider from '@site/src/components/SectionDivider'; -A sample CRUD app to test Keploy integration capabilities using FastHttp and Postgres +This guide walks you through generating tests and DB mocks for a sample CRUD app built with FastHttp and Postgres using Keploy. ## Using Docker Compose -### Clone a sample CRUD App ๐Ÿงช +### Clone the sample CRUD App ๐Ÿงช ```bash git clone https://github.com/keploy/samples-go.git && cd samples-go/fasthttp-postgres @@ -66,6 +66,8 @@ Keploy captures these requests to automatically generate test suites with test c #### Generate a Test Case +##### Post Requests + ```bash curl --request POST \ --url http://localhost:8080/authors \ @@ -73,62 +75,18 @@ curl --request POST \ --data '{"name":"Author Name"}' ``` -Here's a peek of what you get: - -```json -{"id": 1, "name": "Author Name"} -``` - This API call generates a test case along with the required mocks. You can find the generated files in the Keploy directory, including `test-1.yml` and `mocks.yml`. You can continue by making additional API calls to generate more test cases. -```yaml -version: api.keploy.io/v1beta2 -kind: Http -name: test-1 -spec: - metadata: {} - req: - method: POST - proto_major: 1 - proto_minor: 1 - url: http://localhost:8080/authors - header: - Accept: "*/*" - Content-Length: "23" - Content-Type: application/json - Host: localhost:8080 - User-Agent: curl/7.68.0 - body: |- - {"name":"Author Name"} - body_type: "" - resp: - status_code: 201 - header: - Content-Type: application/json - body: '{"id": 1, "name": "Author Name"}' - body_type: "" - status_message: "" - proto_major: 0 - proto_minor: 0 - objects: [] - assertions: - noise: - - header.Date - created: 1696834280 -``` - -#### Fetch Books from App +##### Get Requests ```bash curl --request GET --url http://localhost:8080/books ``` -After running this request, more new test and mock files will be generated in your project directory. - -### Run Tests +### ๐Ÿƒโ€โ™€๏ธ Run the Tests Time to run the testcases which were generated from the previous API calls.. @@ -158,11 +116,11 @@ Happy coding! โœจ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ปโœจ -A sample CRUD app to test Keploy integration capabilities using FastHttp and Postgres +This guide walks you through generating tests and DB mocks for a sample CRUD app built with FastHttp and Postgres using Keploy. -### Clone a sample CRUD App ๐Ÿงช +### Clone the sample CRUD App ๐Ÿงช ```bash git clone https://github.com/keploy/samples-go.git && cd samples-go/fasthttp-postgres @@ -220,7 +178,7 @@ With the application running successfully, you can begin generating test cases b #### Generate a Test Case -A simple POST call: +##### Post Requests ```bash curl --request POST \ @@ -229,26 +187,18 @@ curl --request POST \ --data '{"name":"Author Name"}' ``` -An Author entry appears: - -```json -{"id": 1, "name": "Author Name"} -``` - This API call generates a test case along with the required mocks. You can find the generated files in the Keploy directory, including `test-1.yml` and `mocks.yml`. You can continue by making additional API calls to generate more test cases. -#### Fetch Books from App - +##### Get Requests ```bash curl --request GET --url http://localhost:8080/books ``` -You should now see the newly generated test and mock files in your project directory. -### Run Tests +### ๐Ÿƒโ€โ™€๏ธ Run the Tests You are now ready to run the generated test cases. From 9486b41a8849c60459963df1c2dace4c8b3b7ed5 Mon Sep 17 00:00:00 2001 From: Akella Srinivas Date: Mon, 2 Feb 2026 23:09:48 +0530 Subject: [PATCH 7/7] fix(docs): add FastHTTP Postgres sample run and test instructions Signed-off-by: Akella Srinivas --- versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md b/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md index a66c53a34..d700656f9 100644 --- a/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md +++ b/versioned_docs/version-4.0.0/quickstart/go-fasthttp-postgres.md @@ -216,4 +216,6 @@ Final thoughts? Dive deeper! Try different API calls, tweak the DB response in t Congrats on the journey so far! You've seen Keploy's power, flexed your coding muscles, and had a bit of fun too! Now, go out there and keep exploring, innovating, and creating! Remember, with the right tools and a sprinkle of fun, anything's possible. +Happy coding! โœจ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ปโœจ + Hope this helps you out, if you still have any questions, reach out to us .