Skip to main content

Featured

How to Visualize your JSON 🕵🏼?

A simple way to view and segregate the complex JSON Hello Peeps, Welcome back to another blog 😉. I hope everything is going well for you. Many people prefer the JSON format for APIs, databases, and other applications for a variety of reasons. Some JSON requests or responses are simple and only contain a few objects. On numerous occasions, you may be required to handle a complex response. I wrote a blog about parsing complex responses before using https://jsonpathfinder.com/ In most cases, however, you will need to further investigate your JSON payload or responses for various reasons and analytical purposes. Are you a visual learner or a fan of mind maps? Then you will undoubtedly fall in love with this tool ❤️ JSON Crack I recently came across this tool and found it’s worth sharing with the community 👓 Once you land on the home page, click “GO TO EDITOR” Now you will see a sample JSON beatified and visualized. To visualize it, clear the left side pane and paste your JSON. For instan

How to mock the APIs and how is that helpful?

 

When and how to use Mock Servers and how to set up a Mock server in Postman?

What is a Mock Server?

During your API Testing journey, you cannot wait every time for your API to be completely ready.

We might have the API documentation with the sample responses. So what do we? Using the sample response we can create mock APIs and that endpoint can be used for your testing purposes.

You might have heard the term “Mock servers”, it is nothing but a single base URL with multiple API endpoints configured to return the specified response every time. So every time you hit the specific endpoint, the same response is returned.

How is that helpful?

  1. We can analyze the response body and understand what is expected in the body
  2. We can start writing the assertions for our response body
  3. This helps to continue development even when an external service fails.
  4. This avoids data sharing and supports to test the endpoints individually.

To know more about Mock servers please check here.

How to create a “Mock Server” using Postman:

There are few ways of initiating the process:

Option 1: Clicking the “New” at the top

Option 2: Click the three dots next to the collection, and select “Mock Collection”

Option 3: Navigating the “Mock Servers” tab in the left pane.

All the options will land-up in the mock server page.

Prerequisite:

You need to add “Example” ”response to the request. To know more about it read here.

What next?

  1. By selection any of the listed options above, land on the “Create Mock server” page. If you are doing using the existing collection select it, and follow the instructions as below:

2. Tada, the Mock server is now created.

3. New environment with the name of mock server is created and the mockURL is added as a variable “url” automatically.

4. Now move back to the collection. Instead of the baseURL, you can replace it with the mock server URL.

5. If you hit send, the same response is returned for every run, based on the example response added.

6. Now if the server is unavailable, this request will respond with the constant response.

Based on different use cases, the API responses are mocked and used accordingly.

For more details refer: https://www.mock-server.com

I hope this was useful to you. See you soon in a another blogpost soon!!

Comments

Popular Posts