0% found this document useful (0 votes)
85 views

API Testing

The document contains API endpoints, request methods, request bodies, and response bodies for different APIs. It shows GET, POST, PUT, and DELETE requests made to APIs at reqres.in and dummy.restapiexample.com. The responses include returning users, creating, updating, and deleting records, with expected status codes of 200 for success and 400 for failure. Validation steps are listed to check response codes and contents against expected values.

Uploaded by

Kamesh Bujji
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views

API Testing

The document contains API endpoints, request methods, request bodies, and response bodies for different APIs. It shows GET, POST, PUT, and DELETE requests made to APIs at reqres.in and dummy.restapiexample.com. The responses include returning users, creating, updating, and deleting records, with expected status codes of 200 for success and 400 for failure. Validation steps are listed to check response codes and contents against expected values.

Uploaded by

Kamesh Bujji
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 6

CODE API BODY

NA

GET https://reqres.in/api/user?page2

NA

GET https://reqres.in/api/user/2

{
"name"= "ShivaKamesh",
"Job"="Leader"

POST https://reqres.in/api/user }

{
"email":
"[email protected]",
"password": "cityslicka"
POST https://reqres.in/api/login }

{
"email":"peter@klaven"
}
POST https://reqres.in/api/login

GET https://dummy.restapiexample.com/api/v1/employees
GET https://dummy.restapiexample.com/api/v1/employee/1

{
"name": "Anil",
"Job":"QA Engineeer",
"Age": "20",
"salary":"65000"

}
POST https://dummy.restapiexample.com/api/v1/create

{
"name": "Anil",
"salary": 950500,
"age": 32
}

PUT https://dummy.restapiexample.com/api/v1/update/21

https://dummy.restapiexample.com/api/v1/delete/2

DELETE
SUCCESS RESPONSE Failure Response Status code

Return all users in page NA

200

Return Single user NA

200

{ NA
"name": "ShivaKamesh",
"Job": "Leader",
"id": "552",
"createdAt": "2022-10- 200
12T09:18:55.044Z"
}

{ NA
"token": "QpwL5tke4Pnpja7X4"
}
201

{ NA
"error": "Missing password"
}
400
{
"status": "success",
"data": {
"id": 1,
"employee_name": "Tiger
Nixon",
"employee_salary": 320800,
"employee_age": 61,
"profile_image": ""
}, 200
"message": "Successfully!
Record has been fetched."
}

{
"status": "success",
"data": {
"name": "Anil",
"Job": "QA Engineeer",
"Age": "20",
"salary": "65000",
"id": 3202
}, 200
"message": "Successfully!
Record has been added."
}

{
"status": "success",
"data": {
"name": "Anil",
"salary": 950500,
"age": 32
}, 200
"message": "Successfully!
Record has been updated."
}

{
"status": "success",
"data": "20",
"message": "Successfully! 200
Record has been deleted"
}
validation

tests["validatio code"] = responseCode.code == 200;


tests["validating response body"] = responseBody.has("data");

var response = JSON.parse(responseBody);


tests["page no"] = response.page == 5;
tests["page no"] = response.total == 12;

tests["validating response body"] = responseBody.has("Janet");


tests["validating response body"] = responseBody.has("weaver");
--------------------OR-------------------------------------------
var response = JSON.parse(responseBody);
tests["response first name"] = response.data.first_name == "Janet";
tests["response last name"] = response.data.last_name == "Weaver";

var response = JSON.parse(responseBody);


tests["response first name"] = response.data.first_name == "Janet";
tests["response last name"] = response.data.last_name == "Weaver";

tests["validating Token Check"] = responseBody.has("token");

var response = JSON.parse(responseBody);


tests["response first name"] = response.data.first_name == "Janet";
tests["response last name"] = response.data.last_name == "Weaver";

You might also like