Test-app-url-shortner - A sample url shortener app to test Keploy integration capabilities

test-app-url-shortner

A sample url shortener app to test Keploy integration capabilities

The app does 2 things:

  1. Generate shortned url
curl --request POST \
  --url http://localhost:8080/url \
  --header 'content-type: application/json' \
  --data '{
  "url": "https://google.com"
}'

this will return the shortned url

{
  "data": {
    "url": "http://localhost:8080/Lhr4BWAi"
  },
  "status": 200
}
  1. Redirect to original url from shortened url
curl --request GET \
  --url http://localhost:8080/Lhr4BWAi

or by querying through the browser http://localhost:8080/Lhr4BWAi

Installation

git clone https://github.com/keploy/test-app-url-shortner
cd test-app-url-shortner
go mod tidy

The App also requires mongo

docker container run -it  -p 27017:27017 mongo

Add Keploy SDK

To add the keploy the SDK we need to wrap the dynamodb client and webgo router. Instructions are here - https://github.com/keploy/go-sdk/blob/main/README.md

You can also checkout to the keploy branch which has the integrations already done and enter your API key in the keploy method

kply := keploy.NewApp("url-shortener", "<API_KEY>", "https://api.keploy.io", host, port)

Capture mode

To capture testcases, set the KEPLOY_SDK_MODE to "capture" and start the app

export KEPLOY_SDK_MODE="capture" && go run generator.go main.go

Now perform any of the above requests, and they will be captured as a testcase and would be visible in the web UI testcases

Test mode

Now that we have our testcase captured, we can run them. We need to change the KEPLOY_SDK_MODE to 'test`

export KEPLOY_SDK_MODE="test" && go run generator.go main.go

Now you can also stop mongo. It'll be mocked by the SDK!

In about 5 secs delay, the tests would start running. The logs will help us understand the status. We can get deeper insight through the test runs tab in the web console.

testruns testruns testruns

Similar Resources

Grab is a tool that downloads source code repositories into a convenient directory layout created from the repo's URL's domain and path

Grab is a tool that downloads source code repositories into a convenient directory layout created from the repo's URL's domain and path. It supports Git, Mercurial (hg), Subversion, and Bazaar repositories.

Jun 2, 2022

CLI program for SEO 301 & 302 url rewrites in fastly with more magento features soon to come

Magento-Fastly Table of Contents Magento-Fastly Development & Testing Install fastly cli Features Installation Usage Development & Testing To test thi

Oct 29, 2021

Argo Workflows URL Finder

Argo Workflows URL Finder When Argo Workflows archives a workflow, the URL changes, and the URL cannot be pre-determined. If you're using tools such a

Aug 25, 2022

A terminal based typing test.

A terminal based typing test.

What A terminal based typing test. Installation Linux sudo curl -L https://github.com/lemnos/tt/releases/download/v0.4.0/tt-linux -o /usr/local/bin/tt

Dec 28, 2022

A command-line tool and library for generating regular expressions from user-provided test cases

A command-line tool and library for generating regular expressions from user-provided test cases

Table of Contents What does this tool do? Do I still need to learn to write regexes then? Current features How to install? 4.1 The command-line tool 4

Jan 9, 2023

Typing test in your terminal

Typing test in your terminal

Typer Typing test in your terminal Installation go get github.com/maaslalani/typer/cmd/typer Usage To begin a typing test simply type typer. This wil

Jan 6, 2023

A command line http test tool. Maintain the case via git and pure text

A command line http test tool. Maintain the case via git and pure text

httptest A command line http test tool Maintain the api test cases via git and pure text We want to test the APIs via http requests and assert the res

Dec 16, 2022

Small CLI Tool to store test artifacts in a tamperproof way

Small CLI Tool to store test artifacts in a tamperproof way

Oct 3, 2022
Rinaugo - Golang library with functional capabilities

RinauGo RinauGo adds some ADT to Golang, and functional programming capabilities

Dec 13, 2022
Go-test-app - Test application to verify environment deployment and reachability over HTTP

Test app Test application to verify environment deployment and reachability over

May 23, 2022
A crunchyroll api integration in go with included cli

crunchyroll-go A Go library & cli for the undocumented crunchyroll api. You surely need a crunchyroll premium account to get full (api) access. CLI ??

Dec 18, 2022
Instal - Install any binary app from a script URL
Instal - Install any binary app from a script URL

??️ Install any binary app from a script URL. this cli app is an alternative to

Jun 30, 2022
tfacon is a CLI tool for connecting Test Management Platforms and Test Failure Analysis Classifier.

Test Failure Classifier Connector Description tfacon is a CLI tool for connecting Test Management Platforms and Test Failure Analysis Classifier. Test

Jun 23, 2022
Sample API made in Go

GoAPI-sample Sample API made in Go. Especially for those who want to develop API in Go and are beginners. Variables Endpoint Vars - /token - To genera

Sep 28, 2022
A sample FaaS function that gets a stock quote and 30 day history by symbol and returns a HTML page with a generates SVG sparkline.

faas stonks This uses serverless technology to get a stock quote and 30 day sparkline from Yahoo Finance. Deployment Nimbella account Namespace with o

Sep 23, 2021
LINE account link: Sample code for LINE account link
LINE account link: Sample code for LINE account link

LINE account link: Sample code for LINE account link This is sample code to demostration LINE chatbot account link, refer to document https://develope

Dec 11, 2021
CLI and web app to convert HTML markup to go-app.dev's syntax.
CLI and web app to convert HTML markup to go-app.dev's syntax.

HTML to go-app Converter CLI and web app to convert HTML markup to go-app.dev's syntax. Installation CLI Static binaries are also available on GitHub

Dec 18, 2022
Go-cent-app - CENT.APP GO Package

CENT.APP - GO Package Official documentation - https://cent.app/en/merchant/api

Dec 20, 2022