Check below link for interview Q&A API TESTING:
JSON Server is a simple project that helps you to setup a REST API with CRUD operations very fast. So let's learn how we can create fake rest api using json-server, It is useful for building frontend apps and for testing integration components.
Step-1:
Download node js, refer below link:
https://nodejs.org/en/download/
Open a command prompt (or PowerShell), and enter the following:
node –v
The system should display the Node.js version installed on your system. You can do the same for NPM:
npm –v
For above two commands you should get response as below :
C:\Users>node -v
v10.16.3
C:\Users>npm -v
6.9.0
Step:2
npm install -g json-server
***************************
***************************
Step-3
Create a json file as db.json and open cmd in that path
Define the json format:
{
"employees": [
{
"id": 1,
"first_name": "sidharth",
"last_name": "shukla",
"email": "sidharth@automationreinvented.com"
},
{
"id": 2,
"first_name": "Steve",
"last_name": "smith",
"email": "steve@automationreinvented.com"
},
{
"id": 3,
"first_name": "virat",
"last_name": "kohli",
"email": "virat@automationreinvented.com"
}
]
}
Step-04:
Run the below command from command prompt
json-server --watch db.json
Step-05:
By Default it will take localhost:3000, Now we can open URL http://localhost:3000/employees in the browser
*************************************************
Framework Design Tips & Interview Question-Click Here
********************************************
Step-06:
How to test in Postman?
Just open postman tool and ru below URI:
It's possible to extend URLs with further parameter. E.g. you can apply filtering by using URL parameters like you can see in the following:
http://localhost:3000/employees?last_name=shukla
http://localhost:3000/employees?first_name=sidharth
http://localhost:3000/employees/1
Validate the status code and response body.
Automation Testing/SDET Framework Design Link
Java Related Interview Question Set LINK
GIT Interview Question Set LINK
Step-07:
The following HTTP endpoints are created automatically by JSON server:
GET /employees
GET /employees/{id}
POST /employees
PUT /employees/{id}
PATCH /employees/{id}
So all the above methods can be tested both from Postman or Rest Assured.
NOTE: Learn (API-Microservice)Testing+(CoreJava+UI)-SDET with Self Paced Videos and one LIVE Doubt Session with the Author of this blog who is working as an SDET @ Amazon.
SELF PACED TRANING VIDEOS AVAILABLE with Doubt Session @4500/-(API+Postman+RestAssured+Framework+GIT+Jenkins+Project+DoubtSession(1-1)) and 6500/- (API+UI) Check Training Page for Course Content or reach out @whatsapp +91-9619094122
***********************************************************
- How to setup API automation framework with gradle from scratch?
Click Here for Steps
*************************************************
- Explain testNG annotation in sequence with real time scenario?example of @After@Before in TestNG?selenium interview qus/testng
*************************************************
API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign
Java Related Interview Question Set
https://automationreinvented.blogspot.com/search/label/Java
GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT
Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions
No comments:
Post a Comment