No need to write Testcases again!!

Nishant Mishra
5 min readJun 10, 2022


Testing APIs manually could a frustrating task.

I have been exploring different tools to do automation testing. So, next time I don’t have to execute the same things again manually.

Over the period of last few weeks, I have been exploring and experimenting with various testing tools and frameworks, and during that I found that with Postman, I can do my API management as well as write testcases to assert the API responses using Postman test snippet feature.

I was amazed to automate test cases but frustrated to write test scripts to check API status code or data length etc…

Then, I looked for more testing automation tools like Rest Assured, Selenium, Katalon, etc… but these also required writing test cases, and also required writing data mocks.

After this, I started looking for no-code test automation tools and found Keploy with which I was able to record Postman API call as a test case.

In this article, I will brief about the following steps that I took to automate my test cases:
1. Setting up a sample application(URL Shortener) locally — optional
2. Creating test snippets in Postman
3. Recording test cases in Keploy

Moving on to the first step…

Setting up a Sample Application (URL Shortener)

Let’s clone and run a sample URL Shortener application locally.

git clone && cd samples-go/echo-sqlgo mod download

Start the PostgreSQL instance in Docker for this sample application.
In Postgres DB the sample application is storing the shortened URL for a given long URL.

docker-compose up -d

Now open a new terminal and run the sample application

go run handler.go main.go

Doing this you will start the localhost server for the URL shortener. application.

Now we can try making some API calls

Let’s Post a long URL, say, , which will add a shortened URL in the database.

You can import the following curl into Postman

curl --request POST \
--url http://localhost:8080/url \
--header 'content-type: application/json' \
--data '{
"url": ""
Adding an URL for the API call

After making the API call, you will get the shortened URL for

Shortened URL for the provided link

Let make another API call to GET the shortened URL content.

Adding the URL for GET Request
curl --request GET \
--url http://localhost:8080/GuwHC
Content of the shortened URL

Since we understood both the API of the sample application, lets automate the testing for these APIs.

Creating test snippets in Postman

Moving towards the testing of this API!

I will be making the following testcases here:

  1. Status code
  2. Response time
Testing our API

Now, as I have done above.

Just to check if my request gives me a status 200/201/202 etc, or to check the response Time, I have to manually write testcases in Postman.

This seems plausible when the testing is done on a small scale.

What would you do if you have an API with 1000+ data in it and you have to verify each of its content?

Recording test cases in Keploy

To get started with Keploy, I will follow the below steps:

git clone && cd keploydocker-compose up

Once the Keploy server is up and running, we will start our application server over localhost.

To do that, run the following command in the terminal.

docker-compose up -dgo run handler.go main.go

Once the server is setup, run your Postman as usual and make API calls.

Keploy locahost can be accessed on localhost:8081 and you can use the following link to get to the test cases directly

Test-cases for my API call requests

As you can see, we have our testcases generated by Keploy and now we just need to start testing.

Moving forwards, kill your localhost and run the below command to do run testing

go test -coverpkg=./... -covermode=atomic  ./...

this should show you have 74.4% coverage without writing any code!

Start your server again with

go run handler.go main.go

go back to keploy localhost and check the Test runs

TestRun for the API
TestRuns of our API calls

You can find that Keploy has done in total 6 tests and each tests have Passed.

The major point here is that we didn’t made any test case on our own🤩!


We just did API Testing on both Postman and Keploy and as we experienced,

one has to add test cases using snippets when testing using Postman.

Whereas I didn’t had to write a single line of test script to do testing.

Like this, We are done with the article!!

Test your API without any burden of manually writing Test Cases and deliver an error-free API 😁.

That’s all to it!

Don’t forget give me a follow as I’ll publish more such blogs related to API 😁

— by Nishant Mishra