Install and Configure REST API for Rest Assured
In the previous post we learned about Extracting a JSON Response with Rest Assured and JSON Path. In this post we will Install and Configure a Fake Rest API on our local system.
Below is the REST API that will be Installing on our system:
First, we will create a db.json file and place it on desktop:
{ "posts": [ { "id": 1, "title": "json-server", "author": "typicode" } ], "comments": [ { "id": 1, "body": "some comment", "postId": 1 } ], "profile": { "name": "typicode" } }
Then, we will install a JSON-SERVER on our local system using the following command:
$ npm install -g json-server
You will see output as following:
Now to traverse to Desktop via Terminal and then start JSON-SERVER using following command:
json-server --watch db.json
You will see output as following:
Go to http://localhost:3000/posts/1 in your browser, you'll get
In next post we will learn about automating the post request and sending data as a String in the body.
Comments
Post a Comment