Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "info": {
- "_postman_id": "ae24430b-d0c0-4b0c-91ff-90a060d4611b",
- "name": "Booking Tests",
- "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
- },
- "item": [
- {
- "name": "POST Booking",
- "item": [
- {
- "name": "First Name",
- "item": [
- {
- "name": "firstName = \"Pauline\"",
- "event": [
- {
- "listen": "test",
- "script": {
- "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
- "exec": [
- "const body = pm.response.json();",
- "pm.test(\"firstname shows updated value\", function() {",
- " pm.expect(body.booking).to.have.property(\"firstname\", \"Pauline\"); ",
- "});"
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
- "exec": [
- "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
- "requestBody.firstname = \"Pauline\";",
- "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "name": "Content-Type",
- "value": "application/json",
- "type": "text"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "{{requestBody}}"
- },
- "url": {
- "raw": "{{url}}/booking",
- "host": [
- "{{url}}"
- ],
- "path": [
- "booking"
- ]
- }
- },
- "response": []
- },
- {
- "name": "firstName = \"\"",
- "event": [
- {
- "listen": "test",
- "script": {
- "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
- "exec": [
- "pm.test(\"Status code is 500\", function () {",
- " pm.response.to.have.status(500);",
- "});"
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
- "exec": [
- "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
- "requestBody.firstname = \"\";",
- "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "name": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "{{requestBody}}"
- },
- "url": {
- "raw": "{{url}}/booking",
- "host": [
- "{{url}}"
- ],
- "path": [
- "booking"
- ]
- }
- },
- "response": []
- },
- {
- "name": "firstName = NULL",
- "event": [
- {
- "listen": "test",
- "script": {
- "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
- "exec": [
- "pm.test(\"Status code is 500\", function () {",
- " pm.response.to.have.status(500);",
- "});"
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
- "exec": [
- "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
- "requestBody.firstname = null;",
- "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "name": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "{{requestBody}}"
- },
- "url": {
- "raw": "{{url}}/booking",
- "host": [
- "{{url}}"
- ],
- "path": [
- "booking"
- ]
- }
- },
- "response": []
- }
- ],
- "_postman_isSubFolder": true
- },
- {
- "name": "Last Name",
- "item": [
- {
- "name": "lastName = \"Smith\"",
- "event": [
- {
- "listen": "test",
- "script": {
- "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
- "exec": [
- "const body = pm.response.json();",
- "pm.test(\"lastname shows updated value\", function() {",
- " pm.expect(body.booking).to.have.property(\"lastname\", \"Farrell\"); ",
- "});"
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
- "exec": [
- "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
- "requestBody.lastname = \"Farrell\";",
- "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "name": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "{{requestBody}}"
- },
- "url": {
- "raw": "{{url}}/booking",
- "host": [
- "{{url}}"
- ],
- "path": [
- "booking"
- ]
- }
- },
- "response": []
- },
- {
- "name": "lastName = \"\"",
- "event": [
- {
- "listen": "test",
- "script": {
- "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
- "exec": [
- "pm.test(\"Status code is 500\", function () {",
- " pm.response.to.have.status(500);",
- "});"
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
- "exec": [
- "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
- "requestBody.lastname = \"\";",
- "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "name": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "{{requestBody}}"
- },
- "url": {
- "raw": "{{url}}/booking",
- "host": [
- "{{url}}"
- ],
- "path": [
- "booking"
- ]
- }
- },
- "response": []
- },
- {
- "name": "lastName = NULL",
- "event": [
- {
- "listen": "test",
- "script": {
- "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
- "exec": [
- "pm.test(\"Status code is 500\", function () {",
- " pm.response.to.have.status(500);",
- "});"
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
- "exec": [
- "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
- "requestBody.lastname = null;",
- "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "name": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "{{requestBody}}"
- },
- "url": {
- "raw": "{{url}}/booking",
- "host": [
- "{{url}}"
- ],
- "path": [
- "booking"
- ]
- }
- },
- "response": []
- },
- {
- "name": "totalPrice = 999",
- "event": [
- {
- "listen": "test",
- "script": {
- "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
- "exec": [
- "const body = pm.response.json();",
- "pm.test(\"totalprice shows updated value\", function() {",
- " pm.expect(body.booking).to.have.property(\"totalprice\", 999); ",
- "});"
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
- "exec": [
- "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
- "requestBody.totalprice = 999;",
- "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "name": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "{{requestBody}}"
- },
- "url": {
- "raw": "{{url}}/booking",
- "host": [
- "{{url}}"
- ],
- "path": [
- "booking"
- ]
- }
- },
- "response": []
- }
- ],
- "_postman_isSubFolder": true
- },
- {
- "name": "Total Price",
- "item": [
- {
- "name": "totalPrice = 9.99",
- "event": [
- {
- "listen": "test",
- "script": {
- "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
- "exec": [
- "const body = pm.response.json();",
- "pm.test(\"totalprice ignores decimal value\", function() {",
- " pm.expect(body.booking).to.have.property(\"totalprice\", 9); ",
- "});"
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
- "exec": [
- "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
- "requestBody.totalprice = 9.99;",
- "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "name": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "{{requestBody}}"
- },
- "url": {
- "raw": "{{url}}/booking",
- "host": [
- "{{url}}"
- ],
- "path": [
- "booking"
- ]
- }
- },
- "response": []
- },
- {
- "name": "totalPrice = 0",
- "event": [
- {
- "listen": "test",
- "script": {
- "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
- "exec": [
- "const body = pm.response.json();",
- "pm.test(\"totalprice is zero\", function() {",
- " pm.expect(body.booking).to.have.property(\"totalprice\", 0); ",
- "});"
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
- "exec": [
- "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
- "requestBody.totalprice = 0;",
- "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "name": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "{{requestBody}}"
- },
- "url": {
- "raw": "{{url}}/booking",
- "host": [
- "{{url}}"
- ],
- "path": [
- "booking"
- ]
- }
- },
- "response": []
- },
- {
- "name": "totalPrice = NULL",
- "event": [
- {
- "listen": "test",
- "script": {
- "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
- "exec": [
- "pm.test(\"Status code is 500\", function () {",
- " pm.response.to.have.status(500);",
- "});"
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
- "exec": [
- "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
- "requestBody.totalprice = null;",
- "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "name": "Content-Type",
- "type": "text",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "raw": "{{requestBody}}"
- },
- "url": {
- "raw": "{{url}}/booking",
- "host": [
- "{{url}}"
- ],
- "path": [
- "booking"
- ]
- }
- },
- "response": []
- }
- ],
- "_postman_isSubFolder": true
- }
- ],
- "event": [
- {
- "listen": "prerequest",
- "script": {
- "id": "12c3e61b-5203-42ea-a092-83c31f657114",
- "type": "text/javascript",
- "exec": [
- "pm.environment.set(\"requestBody\", JSON.stringify({",
- " \"firstname\" : \"Jim\",",
- " \"lastname\" : \"Brown\",",
- " \"totalprice\" : 111,",
- " \"depositpaid\" : true,",
- " \"bookingdates\" : {",
- " \"checkin\" : \"2018-01-01\",",
- " \"checkout\" : \"2019-01-01\"",
- " },",
- " \"additionalneeds\" : \"Breakfast\"",
- "}));"
- ]
- }
- },
- {
- "listen": "test",
- "script": {
- "id": "407911c0-ae0e-41ad-8e9a-6f037e5d71ed",
- "type": "text/javascript",
- "exec": [
- ""
- ]
- }
- }
- ]
- }
- ],
- "event": [
- {
- "listen": "prerequest",
- "script": {
- "id": "f02dec7a-e638-4f44-8f36-779cb831c4fc",
- "type": "text/javascript",
- "exec": [
- ""
- ]
- }
- },
- {
- "listen": "test",
- "script": {
- "id": "a53d68e9-acb1-4210-8877-462b1a20326d",
- "type": "text/javascript",
- "exec": [
- ""
- ]
- }
- }
- ]
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement