Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 142 additions & 41 deletions APITesting.postman_collection.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,121 @@
{
"info": {
"_postman_id": "ced79cc6-dc34-4425-a7b7-facbbe08e881",
"name": "API Testing",
"_postman_id": "ae80b739-3a26-4c32-8fba-f44639622c25",
"name": "API testing",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "16825267",
"_collection_link": "https://interstellar-crater-618961.postman.co/workspace/Deepak~bf826488-9c9f-45b5-b1c9-8f9f987aa2b6/collection/16825267-ced79cc6-dc34-4425-a7b7-facbbe08e881?action=share&creator=16825267&source=collection_link"
"_exporter_id": "29907652"
},
"item": [
{
"name": "Get Req",
"name": "New Request",
"request": {
"method": "GET",
"header": []
},
"response": []
},
{
"name": "New Request Copy",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n\r\n\"data\": {\r\n\r\n\"email\": \"amit@test.in\",\r\n\r\n\"first_name\": \"amit\",\r\n\r\n\"last_name\": \"pandey\"\r\n\r\n}\r\n\r\n}",
"options": {
"raw": {
"language": "text"
}
}
},
"url": {
"raw": "https://reqres.in/api/users/",
"protocol": "https",
"host": [
"reqres",
"in"
],
"path": [
"api",
"users",
""
]
}
},
"response": []
},
{
"name": "Test Restponse Status Code",
"event": [
{
"listen": "test",
"script": {
"exec": [
"\r",
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"\r",
"pm.response.to.have.status(200);\r",
"\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "https://reqres.in/api/user/13",
"protocol": "https",
"host": [
"reqres",
"in"
],
"path": [
"api",
"user",
"13"
]
}
},
"response": []
},
{
"name": "Check JSON values",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Body matches string\", function () {\r",
" pm.expect(pm.response.text()).to.include(\"Rachel\");\r",
"\r",
"pm.expect(pm.response.text()).to.include(\"Rachel\");\r",
"\r",
"});\r",
"\r",
"pm.test(\"Your test name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.data.id).to.eql(2);\r",
"pm.test(\"Check JSON Data\", function () {\r",
"\r",
"var jsonData = pm.response.json();\r",
"\r",
"pm.expect(jsonData.data.id).to.eql(12);\r",
"\r",
"});\r",
"\r",
"var resp='{\"data\":{\"id\":2,\"email\":\"janet.weaver@reqres.in\",\"first_name\":\"Janet\",\"last_name\":\"Weaver\",\"avatar\":\"https://reqres.in/img/faces/2-image.jpg\"},\"support\":{\"url\":\"https://reqres.in/#support-heading\",\"text\":\"To keep ReqRes free, contributions towards server costs are appreciated!\"}}'\r",
" \r",
"pm.test(\"Body is correct\", function () {\r",
" pm.response.to.have.body(resp);\r",
"pm.test(\"Check last name \", function () {\r",
"\r",
"var jsonData = pm.response.json();\r",
"\r",
"pm.expect(jsonData.data.last_name).to.eql(\"Howell\");\r",
"\r",
"});\r",
""
"\r",
"pm.test(\"Check url \", function () {\r",
"\r",
"var jsonData = pm.response.json();\r",
"\r",
"pm.expect(jsonData.support.url).contains(\"support-heading\");\r",
"\r",
"});"
],
"type": "text/javascript"
}
Expand All @@ -42,7 +125,7 @@
"method": "GET",
"header": [],
"url": {
"raw": "https://reqres.in/api/users/2",
"raw": "https://reqres.in/api/users/12",
"protocol": "https",
"host": [
"reqres",
Expand All @@ -51,76 +134,73 @@
"path": [
"api",
"users",
"2"
"12"
]
}
},
"response": []
},
{
"name": "POST Req",
"name": "Full Body Match",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Successful POST request\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([201, 202]);\r",
"});\r",
""
"var resp='{\"data\":{\"id\":2,\"email\":\"janet.weaver@reqres.in\",\"first_name\":\"Janet\",\"last_name\":\"Weaver\",\"avatar\":\"https://reqres.in/img/faces/2-image.jpg\"},\"support\":{\"url\":\"https://reqres.in/#support-heading\",\"text\":\"To keep ReqRes free, contributions towards server costs are appreciated!\"}}'\r",
"\r",
"pm.test(\"Body is correct\", function () {\r",
"\r",
"pm.response.to.have.body(resp);\r",
"\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"data\": {\r\n \"email\": \"smitha@test.in\",\r\n \"first_name\": \"Smitha\",\r\n \"last_name\": \"Menon\"\r\n }\r\n}\r\n",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://reqres.in/api/users",
"raw": "https://reqres.in/api/users/2",
"protocol": "https",
"host": [
"reqres",
"in"
],
"path": [
"api",
"users"
"users",
"2"
]
}
},
"response": []
},
{
"name": "Delete",
"name": "Test Post Req",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(204);\r",
"pm.test(\"Successful POST request\", function () {\r",
"\r",
"pm.expect(pm.response.code).to.be.oneOf([201, 202]);\r",
"\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "DELETE",
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{ \r\n \"id\": 5\r\n}\r\n",
"raw": "{\r\n\r\n\"name\": \"checking 2\",\r\n\r\n\"job\": \"leader\"\r\n\r\n}",
"options": {
"raw": {
"language": "json"
Expand All @@ -141,6 +221,27 @@
}
},
"response": []
},
{
"name": "New Request",
"request": {
"method": "DELETE",
"header": [],
"url": {
"raw": "https://reqres.in/api/users/3",
"protocol": "https",
"host": [
"reqres",
"in"
],
"path": [
"api",
"users",
"3"
]
}
},
"response": []
}
]
}