Advertisement
Guest User

Untitled

a guest
May 20th, 2019
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 15.80 KB | None | 0 0
  1. {
  2.     "info": {
  3.         "_postman_id": "ae24430b-d0c0-4b0c-91ff-90a060d4611b",
  4.         "name": "Booking Tests",
  5.         "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  6.     },
  7.     "item": [
  8.         {
  9.             "name": "POST Booking",
  10.             "item": [
  11.                 {
  12.                     "name": "First Name",
  13.                     "item": [
  14.                         {
  15.                             "name": "firstName = \"Pauline\"",
  16.                             "event": [
  17.                                 {
  18.                                     "listen": "test",
  19.                                     "script": {
  20.                                         "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
  21.                                         "exec": [
  22.                                             "const body = pm.response.json();",
  23.                                             "pm.test(\"firstname shows updated value\", function() {",
  24.                                             "    pm.expect(body.booking).to.have.property(\"firstname\", \"Pauline\"); ",
  25.                                             "});"
  26.                                         ],
  27.                                         "type": "text/javascript"
  28.                                     }
  29.                                 },
  30.                                 {
  31.                                     "listen": "prerequest",
  32.                                     "script": {
  33.                                         "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
  34.                                         "exec": [
  35.                                             "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
  36.                                             "requestBody.firstname = \"Pauline\";",
  37.                                             "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
  38.                                         ],
  39.                                         "type": "text/javascript"
  40.                                     }
  41.                                 }
  42.                             ],
  43.                             "request": {
  44.                                 "method": "POST",
  45.                                 "header": [
  46.                                     {
  47.                                         "key": "Content-Type",
  48.                                         "name": "Content-Type",
  49.                                         "value": "application/json",
  50.                                         "type": "text"
  51.                                     }
  52.                                 ],
  53.                                 "body": {
  54.                                     "mode": "raw",
  55.                                     "raw": "{{requestBody}}"
  56.                                 },
  57.                                 "url": {
  58.                                     "raw": "{{url}}/booking",
  59.                                     "host": [
  60.                                         "{{url}}"
  61.                                     ],
  62.                                     "path": [
  63.                                         "booking"
  64.                                     ]
  65.                                 }
  66.                             },
  67.                             "response": []
  68.                         },
  69.                         {
  70.                             "name": "firstName = \"\"",
  71.                             "event": [
  72.                                 {
  73.                                     "listen": "test",
  74.                                     "script": {
  75.                                         "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
  76.                                         "exec": [
  77.                                             "pm.test(\"Status code is 500\", function () {",
  78.                                             "    pm.response.to.have.status(500);",
  79.                                             "});"
  80.                                         ],
  81.                                         "type": "text/javascript"
  82.                                     }
  83.                                 },
  84.                                 {
  85.                                     "listen": "prerequest",
  86.                                     "script": {
  87.                                         "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
  88.                                         "exec": [
  89.                                             "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
  90.                                             "requestBody.firstname = \"\";",
  91.                                             "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
  92.                                         ],
  93.                                         "type": "text/javascript"
  94.                                     }
  95.                                 }
  96.                             ],
  97.                             "request": {
  98.                                 "method": "POST",
  99.                                 "header": [
  100.                                     {
  101.                                         "key": "Content-Type",
  102.                                         "name": "Content-Type",
  103.                                         "type": "text",
  104.                                         "value": "application/json"
  105.                                     }
  106.                                 ],
  107.                                 "body": {
  108.                                     "mode": "raw",
  109.                                     "raw": "{{requestBody}}"
  110.                                 },
  111.                                 "url": {
  112.                                     "raw": "{{url}}/booking",
  113.                                     "host": [
  114.                                         "{{url}}"
  115.                                     ],
  116.                                     "path": [
  117.                                         "booking"
  118.                                     ]
  119.                                 }
  120.                             },
  121.                             "response": []
  122.                         },
  123.                         {
  124.                             "name": "firstName = NULL",
  125.                             "event": [
  126.                                 {
  127.                                     "listen": "test",
  128.                                     "script": {
  129.                                         "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
  130.                                         "exec": [
  131.                                             "pm.test(\"Status code is 500\", function () {",
  132.                                             "    pm.response.to.have.status(500);",
  133.                                             "});"
  134.                                         ],
  135.                                         "type": "text/javascript"
  136.                                     }
  137.                                 },
  138.                                 {
  139.                                     "listen": "prerequest",
  140.                                     "script": {
  141.                                         "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
  142.                                         "exec": [
  143.                                             "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
  144.                                             "requestBody.firstname = null;",
  145.                                             "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
  146.                                         ],
  147.                                         "type": "text/javascript"
  148.                                     }
  149.                                 }
  150.                             ],
  151.                             "request": {
  152.                                 "method": "POST",
  153.                                 "header": [
  154.                                     {
  155.                                         "key": "Content-Type",
  156.                                         "name": "Content-Type",
  157.                                         "type": "text",
  158.                                         "value": "application/json"
  159.                                     }
  160.                                 ],
  161.                                 "body": {
  162.                                     "mode": "raw",
  163.                                     "raw": "{{requestBody}}"
  164.                                 },
  165.                                 "url": {
  166.                                     "raw": "{{url}}/booking",
  167.                                     "host": [
  168.                                         "{{url}}"
  169.                                     ],
  170.                                     "path": [
  171.                                         "booking"
  172.                                     ]
  173.                                 }
  174.                             },
  175.                             "response": []
  176.                         }
  177.                     ],
  178.                     "_postman_isSubFolder": true
  179.                 },
  180.                 {
  181.                     "name": "Last Name",
  182.                     "item": [
  183.                         {
  184.                             "name": "lastName = \"Smith\"",
  185.                             "event": [
  186.                                 {
  187.                                     "listen": "test",
  188.                                     "script": {
  189.                                         "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
  190.                                         "exec": [
  191.                                             "const body = pm.response.json();",
  192.                                             "pm.test(\"lastname shows updated value\", function() {",
  193.                                             "    pm.expect(body.booking).to.have.property(\"lastname\", \"Farrell\"); ",
  194.                                             "});"
  195.                                         ],
  196.                                         "type": "text/javascript"
  197.                                     }
  198.                                 },
  199.                                 {
  200.                                     "listen": "prerequest",
  201.                                     "script": {
  202.                                         "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
  203.                                         "exec": [
  204.                                             "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
  205.                                             "requestBody.lastname = \"Farrell\";",
  206.                                             "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
  207.                                         ],
  208.                                         "type": "text/javascript"
  209.                                     }
  210.                                 }
  211.                             ],
  212.                             "request": {
  213.                                 "method": "POST",
  214.                                 "header": [
  215.                                     {
  216.                                         "key": "Content-Type",
  217.                                         "name": "Content-Type",
  218.                                         "type": "text",
  219.                                         "value": "application/json"
  220.                                     }
  221.                                 ],
  222.                                 "body": {
  223.                                     "mode": "raw",
  224.                                     "raw": "{{requestBody}}"
  225.                                 },
  226.                                 "url": {
  227.                                     "raw": "{{url}}/booking",
  228.                                     "host": [
  229.                                         "{{url}}"
  230.                                     ],
  231.                                     "path": [
  232.                                         "booking"
  233.                                     ]
  234.                                 }
  235.                             },
  236.                             "response": []
  237.                         },
  238.                         {
  239.                             "name": "lastName = \"\"",
  240.                             "event": [
  241.                                 {
  242.                                     "listen": "test",
  243.                                     "script": {
  244.                                         "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
  245.                                         "exec": [
  246.                                             "pm.test(\"Status code is 500\", function () {",
  247.                                             "    pm.response.to.have.status(500);",
  248.                                             "});"
  249.                                         ],
  250.                                         "type": "text/javascript"
  251.                                     }
  252.                                 },
  253.                                 {
  254.                                     "listen": "prerequest",
  255.                                     "script": {
  256.                                         "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
  257.                                         "exec": [
  258.                                             "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
  259.                                             "requestBody.lastname = \"\";",
  260.                                             "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
  261.                                         ],
  262.                                         "type": "text/javascript"
  263.                                     }
  264.                                 }
  265.                             ],
  266.                             "request": {
  267.                                 "method": "POST",
  268.                                 "header": [
  269.                                     {
  270.                                         "key": "Content-Type",
  271.                                         "name": "Content-Type",
  272.                                         "type": "text",
  273.                                         "value": "application/json"
  274.                                     }
  275.                                 ],
  276.                                 "body": {
  277.                                     "mode": "raw",
  278.                                     "raw": "{{requestBody}}"
  279.                                 },
  280.                                 "url": {
  281.                                     "raw": "{{url}}/booking",
  282.                                     "host": [
  283.                                         "{{url}}"
  284.                                     ],
  285.                                     "path": [
  286.                                         "booking"
  287.                                     ]
  288.                                 }
  289.                             },
  290.                             "response": []
  291.                         },
  292.                         {
  293.                             "name": "lastName = NULL",
  294.                             "event": [
  295.                                 {
  296.                                     "listen": "test",
  297.                                     "script": {
  298.                                         "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
  299.                                         "exec": [
  300.                                             "pm.test(\"Status code is 500\", function () {",
  301.                                             "    pm.response.to.have.status(500);",
  302.                                             "});"
  303.                                         ],
  304.                                         "type": "text/javascript"
  305.                                     }
  306.                                 },
  307.                                 {
  308.                                     "listen": "prerequest",
  309.                                     "script": {
  310.                                         "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
  311.                                         "exec": [
  312.                                             "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
  313.                                             "requestBody.lastname = null;",
  314.                                             "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
  315.                                         ],
  316.                                         "type": "text/javascript"
  317.                                     }
  318.                                 }
  319.                             ],
  320.                             "request": {
  321.                                 "method": "POST",
  322.                                 "header": [
  323.                                     {
  324.                                         "key": "Content-Type",
  325.                                         "name": "Content-Type",
  326.                                         "type": "text",
  327.                                         "value": "application/json"
  328.                                     }
  329.                                 ],
  330.                                 "body": {
  331.                                     "mode": "raw",
  332.                                     "raw": "{{requestBody}}"
  333.                                 },
  334.                                 "url": {
  335.                                     "raw": "{{url}}/booking",
  336.                                     "host": [
  337.                                         "{{url}}"
  338.                                     ],
  339.                                     "path": [
  340.                                         "booking"
  341.                                     ]
  342.                                 }
  343.                             },
  344.                             "response": []
  345.                         },
  346.                         {
  347.                             "name": "totalPrice = 999",
  348.                             "event": [
  349.                                 {
  350.                                     "listen": "test",
  351.                                     "script": {
  352.                                         "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
  353.                                         "exec": [
  354.                                             "const body = pm.response.json();",
  355.                                             "pm.test(\"totalprice shows updated value\", function() {",
  356.                                             "    pm.expect(body.booking).to.have.property(\"totalprice\", 999); ",
  357.                                             "});"
  358.                                         ],
  359.                                         "type": "text/javascript"
  360.                                     }
  361.                                 },
  362.                                 {
  363.                                     "listen": "prerequest",
  364.                                     "script": {
  365.                                         "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
  366.                                         "exec": [
  367.                                             "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
  368.                                             "requestBody.totalprice = 999;",
  369.                                             "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
  370.                                         ],
  371.                                         "type": "text/javascript"
  372.                                     }
  373.                                 }
  374.                             ],
  375.                             "request": {
  376.                                 "method": "POST",
  377.                                 "header": [
  378.                                     {
  379.                                         "key": "Content-Type",
  380.                                         "name": "Content-Type",
  381.                                         "type": "text",
  382.                                         "value": "application/json"
  383.                                     }
  384.                                 ],
  385.                                 "body": {
  386.                                     "mode": "raw",
  387.                                     "raw": "{{requestBody}}"
  388.                                 },
  389.                                 "url": {
  390.                                     "raw": "{{url}}/booking",
  391.                                     "host": [
  392.                                         "{{url}}"
  393.                                     ],
  394.                                     "path": [
  395.                                         "booking"
  396.                                     ]
  397.                                 }
  398.                             },
  399.                             "response": []
  400.                         }
  401.                     ],
  402.                     "_postman_isSubFolder": true
  403.                 },
  404.                 {
  405.                     "name": "Total Price",
  406.                     "item": [
  407.                         {
  408.                             "name": "totalPrice = 9.99",
  409.                             "event": [
  410.                                 {
  411.                                     "listen": "test",
  412.                                     "script": {
  413.                                         "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
  414.                                         "exec": [
  415.                                             "const body = pm.response.json();",
  416.                                             "pm.test(\"totalprice ignores decimal value\", function() {",
  417.                                             "    pm.expect(body.booking).to.have.property(\"totalprice\", 9); ",
  418.                                             "});"
  419.                                         ],
  420.                                         "type": "text/javascript"
  421.                                     }
  422.                                 },
  423.                                 {
  424.                                     "listen": "prerequest",
  425.                                     "script": {
  426.                                         "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
  427.                                         "exec": [
  428.                                             "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
  429.                                             "requestBody.totalprice = 9.99;",
  430.                                             "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
  431.                                         ],
  432.                                         "type": "text/javascript"
  433.                                     }
  434.                                 }
  435.                             ],
  436.                             "request": {
  437.                                 "method": "POST",
  438.                                 "header": [
  439.                                     {
  440.                                         "key": "Content-Type",
  441.                                         "name": "Content-Type",
  442.                                         "type": "text",
  443.                                         "value": "application/json"
  444.                                     }
  445.                                 ],
  446.                                 "body": {
  447.                                     "mode": "raw",
  448.                                     "raw": "{{requestBody}}"
  449.                                 },
  450.                                 "url": {
  451.                                     "raw": "{{url}}/booking",
  452.                                     "host": [
  453.                                         "{{url}}"
  454.                                     ],
  455.                                     "path": [
  456.                                         "booking"
  457.                                     ]
  458.                                 }
  459.                             },
  460.                             "response": []
  461.                         },
  462.                         {
  463.                             "name": "totalPrice = 0",
  464.                             "event": [
  465.                                 {
  466.                                     "listen": "test",
  467.                                     "script": {
  468.                                         "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
  469.                                         "exec": [
  470.                                             "const body = pm.response.json();",
  471.                                             "pm.test(\"totalprice is zero\", function() {",
  472.                                             "    pm.expect(body.booking).to.have.property(\"totalprice\", 0); ",
  473.                                             "});"
  474.                                         ],
  475.                                         "type": "text/javascript"
  476.                                     }
  477.                                 },
  478.                                 {
  479.                                     "listen": "prerequest",
  480.                                     "script": {
  481.                                         "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
  482.                                         "exec": [
  483.                                             "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
  484.                                             "requestBody.totalprice = 0;",
  485.                                             "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
  486.                                         ],
  487.                                         "type": "text/javascript"
  488.                                     }
  489.                                 }
  490.                             ],
  491.                             "request": {
  492.                                 "method": "POST",
  493.                                 "header": [
  494.                                     {
  495.                                         "key": "Content-Type",
  496.                                         "name": "Content-Type",
  497.                                         "type": "text",
  498.                                         "value": "application/json"
  499.                                     }
  500.                                 ],
  501.                                 "body": {
  502.                                     "mode": "raw",
  503.                                     "raw": "{{requestBody}}"
  504.                                 },
  505.                                 "url": {
  506.                                     "raw": "{{url}}/booking",
  507.                                     "host": [
  508.                                         "{{url}}"
  509.                                     ],
  510.                                     "path": [
  511.                                         "booking"
  512.                                     ]
  513.                                 }
  514.                             },
  515.                             "response": []
  516.                         },
  517.                         {
  518.                             "name": "totalPrice = NULL",
  519.                             "event": [
  520.                                 {
  521.                                     "listen": "test",
  522.                                     "script": {
  523.                                         "id": "7888d9e2-5762-406c-a4d5-58ab992fa862",
  524.                                         "exec": [
  525.                                             "pm.test(\"Status code is 500\", function () {",
  526.                                             "    pm.response.to.have.status(500);",
  527.                                             "});"
  528.                                         ],
  529.                                         "type": "text/javascript"
  530.                                     }
  531.                                 },
  532.                                 {
  533.                                     "listen": "prerequest",
  534.                                     "script": {
  535.                                         "id": "51687b99-9264-415f-b4ce-966e4475d9ee",
  536.                                         "exec": [
  537.                                             "const requestBody = JSON.parse(pm.environment.get(\"requestBody\"));",
  538.                                             "requestBody.totalprice = null;",
  539.                                             "pm.environment.set(\"requestBody\", JSON.stringify(requestBody));"
  540.                                         ],
  541.                                         "type": "text/javascript"
  542.                                     }
  543.                                 }
  544.                             ],
  545.                             "request": {
  546.                                 "method": "POST",
  547.                                 "header": [
  548.                                     {
  549.                                         "key": "Content-Type",
  550.                                         "name": "Content-Type",
  551.                                         "type": "text",
  552.                                         "value": "application/json"
  553.                                     }
  554.                                 ],
  555.                                 "body": {
  556.                                     "mode": "raw",
  557.                                     "raw": "{{requestBody}}"
  558.                                 },
  559.                                 "url": {
  560.                                     "raw": "{{url}}/booking",
  561.                                     "host": [
  562.                                         "{{url}}"
  563.                                     ],
  564.                                     "path": [
  565.                                         "booking"
  566.                                     ]
  567.                                 }
  568.                             },
  569.                             "response": []
  570.                         }
  571.                     ],
  572.                     "_postman_isSubFolder": true
  573.                 }
  574.             ],
  575.             "event": [
  576.                 {
  577.                     "listen": "prerequest",
  578.                     "script": {
  579.                         "id": "12c3e61b-5203-42ea-a092-83c31f657114",
  580.                         "type": "text/javascript",
  581.                         "exec": [
  582.                             "pm.environment.set(\"requestBody\", JSON.stringify({",
  583.                             "    \"firstname\" : \"Jim\",",
  584.                             "    \"lastname\" : \"Brown\",",
  585.                             "    \"totalprice\" : 111,",
  586.                             "    \"depositpaid\" : true,",
  587.                             "    \"bookingdates\" : {",
  588.                             "        \"checkin\" : \"2018-01-01\",",
  589.                             "        \"checkout\" : \"2019-01-01\"",
  590.                             "    },",
  591.                             "    \"additionalneeds\" : \"Breakfast\"",
  592.                             "}));"
  593.                         ]
  594.                     }
  595.                 },
  596.                 {
  597.                     "listen": "test",
  598.                     "script": {
  599.                         "id": "407911c0-ae0e-41ad-8e9a-6f037e5d71ed",
  600.                         "type": "text/javascript",
  601.                         "exec": [
  602.                             ""
  603.                         ]
  604.                     }
  605.                 }
  606.             ]
  607.         }
  608.     ],
  609.     "event": [
  610.         {
  611.             "listen": "prerequest",
  612.             "script": {
  613.                 "id": "f02dec7a-e638-4f44-8f36-779cb831c4fc",
  614.                 "type": "text/javascript",
  615.                 "exec": [
  616.                     ""
  617.                 ]
  618.             }
  619.         },
  620.         {
  621.             "listen": "test",
  622.             "script": {
  623.                 "id": "a53d68e9-acb1-4210-8877-462b1a20326d",
  624.                 "type": "text/javascript",
  625.                 "exec": [
  626.                     ""
  627.                 ]
  628.             }
  629.         }
  630.     ]
  631. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement