The document contains API test cases for various HTTP methods like GET, POST, PUT, DELETE. It lists the URI, request body, expected success response, expected failure response, status code and validation checks for each test case. The test cases cover user validation, login, create, retrieve, update and delete operations on dummy REST API endpoints to validate different scenarios.
1 of 1
Download to read offline
More Related Content
Api test cases.pdf
1. Api test cases
Aug. 22, 2020 116 likes 105,516 views
Education
PAVAN KUMAR BHIMAVARAPU Follow
Test Architect| Training Consultant | Blogger
More Related Content
Similar to Api test cases (20)
More from PAVAN KUMAR BHIMAVARAPU (20)
Featured (20)
Recently uploaded (20)
Api test cases
1. HTTP METHOD TYPE URI BODY SUCCESS RESPONSE FAILURE RESPONSE STATUS CODE COMMENTS Validation GET https://reqres.in/api/users?page=2 NA Returns list of users in a page NA 200 2
represents page number Query parameter: page=2 tests["Validating Status Code"] = responseCode.code == 200; tests["Validating response body"] = responseBody.has("data"); var response =
JSON.parse(responseBody); tests["page no"] = response.page == 2; GET https://reqres.in/api/users/2 NA Returns single user NA 200 2 represents student id Path parameter: /2 var response =
JSON.parse(responseBody); tests["verify firstname"] = response.data.first_name == "Janet"; tests["verify last name"] = response.data.last_name == "Weaver"; POST https://reqres.in/api/users {
"name": "morpheus", "job": "leader" } { "name": "morpheus", "job": "leader", "id": "256", "createdAt": "2018-07- 07T05:43:53.310Z" } NA 201 Create var response = JSON.parse(responseBody);
tests["name"] = response.name == "morpheus"; tests["job"] = response.job == "leader"; tests["Validating Status Code"] = responseCode.code == 201; POST https://reqres.in/api/login { "email":
"peter@klaven", "password": "cityslicka" } { "token": "QpwL5tke4Pnpja7X" } NA 200 Login Success tests["Validating Status Code"] = responseCode.code == 200 ; tests["Validating Token presence"] =
responseBody.has("token"); POST https://reqres.in/api/login { "email": "peter@klaven" } NA { "error": "Missing password" } 400 Login Unsuccesful tests["Validating Status Code"] =
responseCode.code == 400 ; GET http://dummy.restapiexample.com/api/v1/employees NA [{"id":"1","employee_name":"","em ployee_salary":"0","employee_age" :"0","profile_image":""},{"id":"2","
employee_name":"","employee_sal ary":"0","employee_age":"0","profil e_image":""}] 200 OK Get all employee data Path parameter: /employee var response = JSON.parse(responseBody);
tests["name"] = response.data[1].employee_name == "Garrett Winters"; GET http://dummy.restapiexample.com/api/v1/employee/700 na {"id":"700","employee_name":"%2
6lt%3bSCRIPT%20a%3d%60%26gt %3b%60%20SRC%3d%5c%22http %26#58%3b%2f%2fha%26#46%3 bckers%26#46%3borg%2fxss%26 #46%3bjs%5c%22%26gt%3b%26l
t%3b%2fSCRIPT%26gt%3b","empl oyee_salary":"123","employee_age ":"33","profile_image":""} 200 Get a single employee data Path parameter: /employee/719 POST
http://dummy.restapiexample.com/api/v1/create {"name":"test","salary":"12 3","age":"23"} {"name":"test","salary":"123","age" :"23","id":"719"} 200 Create new record in database Path parameter:
/update/719 PUT http://dummy.restapiexample.com/api/v1/update/21 {"name":"test1","salary":"1 123","age":"23"} {"name":"test1","salary":"1123","a ge":"23"} 200 Update an employee record Path
parameter: /update/{id} DELETE http://dummy.restapiexample.com/api/v1/delete/700 {"success":{"text":"successfully! deleted Records"}} 200 Delete an employee record Path Parameter:/delete/{id}
遏
Download to read o line
Download Now
API/Webservice Test cases
Recommended
Unify Earth
Observation products
access with
Gasperi Jerome
Action View Form
Helpers - 1, Season 2
RORLAB
Action Controller
Overview, Season 2
RORLAB
Remote code-with-
expression-language-
injection
Mickey Jack
Introduction to jQuery
- The basics
Maher Hossain
Laravel Security
Standards
Singsys Pte Ltd
WordPress Plugin &
Theme Security -
WordCamp Melbour
John Ford
ASP.NET WEB API
Waldyr Felix
Join the darkside: Seleniu
Seth McLaughlin
XamarinAWSゃр
Takehito Tanabe
Unit testing a er Zend
Michelangelo van Dam
Taking Advantage of the
Eric Shupps
DRYing t
Dhaval D
Install postman on windows
PAVAN KUMAR BHIMAVARAPU
Jenkins Pipeline
PAVAN KUMAR BHIMAVARAPU
SQL Queries for Practice &
PAVAN KUMAR BHIMAVARAPU
MySQL
PAVAN KUMAR BHIMAVARAPU
X Path in
PAVAN KU
Understanding Artificial
APPANION
Four Public Speaking Tips
Ross Simmonds
Di erent Career Paths in Da
Roger Huang
How to Fortify a Diverse
Aggregage
5 Tips fo
O.C. Tann
Timetable.pdf
Muhammad Naeem BSc (Hons)
VS CAD.pptx
VIJAY JADHAV
digital marketing.pptx
Saif Uddin
Introduction to Advance
Katrina Pritchard
Empowe
Auroveda
About Support Terms Privacy Copyright Cookie Preferences
息 2022 際際滷 遏 遏
English
Home Explore Search 遏 遏 Upload Login Signup
1 of 1 遏 遏
1 of 1 遏 遏