diff --git a/04-05/postman_collections/MiniProjects/Add_a_new_product_to_the_store.json b/04-05/postman_collections/MiniProjects/Add_a_new_product_to_the_store.json new file mode 100644 index 00000000..09312436 --- /dev/null +++ b/04-05/postman_collections/MiniProjects/Add_a_new_product_to_the_store.json @@ -0,0 +1,37 @@ +[ + { + "name": "Premium Plan", + "description": "Access to all features for premium users", + "price": 49.99, + "statusCode": 200, + "scenario": "Successful operation" + }, + { + "name": "Basic Plan", + "description": "Limited access to core features", + "price": 19.99, + "statusCode": 200, + "scenario": "Successful operation" + }, + { + "name": "TEST_invalid_name_123", + "description": "TEST_invalid_description_456", + "price": "invalid_price", + "statusCode": 405, + "scenario": "Invalid input" + }, + { + "name": "", + "description": null, + "price": -25, + "statusCode": 405, + "scenario": "Invalid input" + }, + { + "name": "Enterprise Plan", + "description": "Advanced features for organizations", + "price": 99.99, + "statusCode": 200, + "scenario": "Successful operation" + } +] \ No newline at end of file diff --git a/04-05/postman_collections/MiniProjects/Deletes_a_product.json b/04-05/postman_collections/MiniProjects/Deletes_a_product.json new file mode 100644 index 00000000..fdd42434 --- /dev/null +++ b/04-05/postman_collections/MiniProjects/Deletes_a_product.json @@ -0,0 +1,27 @@ +[ + { + "productId": "12345", + "statusCode": 200, + "scenario": "Product deleted" + }, + { + "productId": "67890", + "statusCode": 200, + "scenario": "Product deleted" + }, + { + "productId": "invalid_product_id", + "statusCode": 404, + "scenario": "Not Found" + }, + { + "productId": "unknown123", + "statusCode": 404, + "scenario": "Not Found" + }, + { + "productId": "non_existing_product", + "statusCode": 404, + "scenario": "Not Found" + } +] \ No newline at end of file diff --git a/04-05/postman_collections/MiniProjects/Find_product_by_ID.json b/04-05/postman_collections/MiniProjects/Find_product_by_ID.json new file mode 100644 index 00000000..0642c1d2 --- /dev/null +++ b/04-05/postman_collections/MiniProjects/Find_product_by_ID.json @@ -0,0 +1,27 @@ +[ + { + "productId": "1", + "statusCode": 200, + "scenario": "successful operation" + }, + { + "productId": "2", + "statusCode": 200, + "scenario": "successful operation" + }, + { + "productId": "invalid_product_id", + "statusCode": 404, + "scenario": "Product not found" + }, + { + "productId": "999999", + "statusCode": 404, + "scenario": "Product not found" + }, + { + "productId": "test_invalid_id", + "statusCode": 404, + "scenario": "Product not found" + } +] \ No newline at end of file diff --git a/04-05/postman_collections/MiniProjects/Get_All_Products.json b/04-05/postman_collections/MiniProjects/Get_All_Products.json new file mode 100644 index 00000000..faf29a1c --- /dev/null +++ b/04-05/postman_collections/MiniProjects/Get_All_Products.json @@ -0,0 +1,27 @@ +[ + { + "responseBody": "{\"id\":101,\"name\":\"Product A\",\"description\":\"A high-quality item\",\"price\":29.99}", + "statusCode": 200, + "scenario": "Successful operation" + }, + { + "responseBody": "{\"id\":102,\"name\":\"Product B\",\"description\":\"Durable and reliable\",\"price\":49.99}", + "statusCode": 200, + "scenario": "Successful operation" + }, + { + "responseBody": "{\"id\":\"invalid_id\",\"name\":123,\"description\":false,\"price\":\"ABC\"}", + "statusCode": 400, + "scenario": "Bad Request" + }, + { + "responseBody": "{\"id\":null,\"name\":\"\",\"description\":\"\",\"price\":-20}", + "statusCode": 422, + "scenario": "Unprocessable Entity" + }, + { + "responseBody": "{\"id\":999,\"name\":\"Special Product\",\"description\":\"Limited edition\",\"price\":\"XYZ\"}", + "statusCode": 500, + "scenario": "Internal Server Error" + } +] \ No newline at end of file diff --git a/04-05/postman_collections/MiniProjects/Updates_a_product_in_the_store.json b/04-05/postman_collections/MiniProjects/Updates_a_product_in_the_store.json new file mode 100644 index 00000000..0665ea54 --- /dev/null +++ b/04-05/postman_collections/MiniProjects/Updates_a_product_in_the_store.json @@ -0,0 +1,47 @@ +[ + { + "productId": "P001", + "id": 101, + "name": "2023-10-01", + "description": "2023-10-01", + "price": 25.99, + "statusCode": 200, + "scenario": "Updated Product" + }, + { + "productId": "P002", + "id": 102, + "name": "2023-10-02", + "description": "2023-10-02", + "price": 35.5, + "statusCode": 200, + "scenario": "Updated Product" + }, + { + "productId": "invalid_id", + "id": -1, + "name": "invalid_date", + "description": "invalid_date", + "price": -50, + "statusCode": 404, + "scenario": "Not Found" + }, + { + "productId": "P004", + "id": 103, + "name": "2023-10-03", + "description": "2023-10-03", + "price": 45, + "statusCode": 200, + "scenario": "Updated Product" + }, + { + "productId": "", + "id": 0, + "name": "9999-99-99", + "description": "9999-99-99", + "price": -100, + "statusCode": 404, + "scenario": "Not Found" + } +] \ No newline at end of file diff --git a/04-05/postman_collections/modified_postman_my-products-postman.json b/04-05/postman_collections/modified_postman_my-products-postman.json new file mode 100644 index 00000000..a1ef6ccb --- /dev/null +++ b/04-05/postman_collections/modified_postman_my-products-postman.json @@ -0,0 +1,563 @@ +{ + "info": { + "name": "My-Products API", + "description": "This page is for my products api spec", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "version": "1.0.0" + }, + "variable": [ + { + "key": "baseUrl", + "value": "http://localhost:8080/api", + "type": "string" + }, + { + "type": "integer", + "value": 200, + "key": "statusCode" + } + ], + "item": [ + { + "name": "Products", + "item": [ + { + "name": "Get All Products", + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/products", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products" + ] + }, + "description": "It gives you all products" + }, + "response": [ + { + "name": "Successful operation", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/products", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "cookie": [], + "body": "{\n \"id\": 10,\n \"name\": \"apple\",\n \"description\": \"description of the product\",\n \"price\": 20\n}" + } + ], + "event": [ + { + "listen": "test", + "script": { + "exec": [ + " \n// ********RoostGPT********\n/*\nTest generated by RoostGPT for test MiniProjects using AI Type Azure Open AI and AI Model roostgpt-4-32k\n\n\nTest generated for products for http method type get in postman framework\n\n*/\n\n// ********RoostGPT********\n\n\nconst ld = require('lodash');\nlet responseData;\nconst contentType = pm.response.headers.get('Content-Type');\nif(contentType === \"application/xml\"){\n var parseString = require('xml2js').parseString;\n parseString(pm.response.body, function (err,result) {\n if (err) {\n console.error('Error parsing XML:', err);\n } else {\n responseData = result; \n }\n });\n} else{\n responseData = pm.response.json();\n}\nif (pm.variables.get(\"statusCode\")) {\n pm.expect(parseInt(pm.variables.get(\"statusCode\"))).to.be.equal(pm.response.code);\n}\n\nif (pm.response.code == 200){\n pm.test(\"Successful operation\", function () {\n pm.expect(pm.response.status).to.be.eql(\"OK\");\n });\n\n}\n" + ], + "type": "text/javascript" + } + } + ] + }, + { + "name": "Add a new product to the store", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": {{name_*string}},\n \"description\": {{description_*string}},\n \"price\": {{price_*number}}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/products", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products" + ] + }, + "description": "Add a new product to the store" + }, + "response": [ + { + "name": "Successful operation", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": {{name_*string}},\n \"description\": {{description_*string}},\n \"price\": {{price_*number}}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/products", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "cookie": [], + "body": "{\n \"id\": 10,\n \"name\": \"apple\",\n \"description\": \"description of the product\",\n \"price\": 20\n}" + }, + { + "name": "Invalid input", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": {{name_*string}},\n \"description\": {{description_*string}},\n \"price\": {{price_*number}}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/products", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products" + ] + } + }, + "status": "Method Not Allowed", + "code": 405, + "_postman_previewlanguage": "text", + "header": [], + "cookie": [], + "body": "" + } + ], + "event": [ + { + "listen": "test", + "script": { + "exec": [ + " \n// ********RoostGPT********\n/*\nTest generated by RoostGPT for test MiniProjects using AI Type Azure Open AI and AI Model roostgpt-4-32k\n\n\nTest generated for products for http method type post in postman framework\n\n*/\n\n// ********RoostGPT********\n\n\nconst ld = require('lodash');\nlet responseData;\nconst contentType = pm.response.headers.get('Content-Type');\nif(contentType === \"application/xml\"){\n var parseString = require('xml2js').parseString;\n parseString(pm.response.body, function (err,result) {\n if (err) {\n console.error('Error parsing XML:', err);\n } else {\n responseData = result; \n }\n });\n} else{\n responseData = pm.response.json();\n}\nif (pm.variables.get(\"statusCode\")) {\n pm.expect(parseInt(pm.variables.get(\"statusCode\"))).to.be.equal(pm.response.code);\n}\n\nif (pm.response.code == 200){\n pm.test(\"Successful operation\", function () {\n pm.expect(pm.response.status).to.be.eql(\"OK\");\n });\n\n}\n\nif (pm.response.code == 405){\n pm.test(\"Invalid input\", function () {\n pm.expect(pm.response.status).to.be.eql(\"Method Not Allowed\");\n });\n\n}\n" + ], + "type": "text/javascript" + } + } + ] + }, + { + "name": "Find product by ID", + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/products/:productId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products", + ":productId" + ], + "variable": [ + { + "key": "productId", + "value": "{{productId}}", + "description": "ID of product to return" + } + ] + }, + "description": "Returns a single product" + }, + "response": [ + { + "name": "successful operation", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/products/:productId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products", + ":productId" + ], + "variable": [ + { + "key": "productId", + "value": "{{productId}}" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "cookie": [], + "body": "{\n \"id\": 10,\n \"name\": \"apple\",\n \"description\": \"description of the product\",\n \"price\": 20\n}" + }, + { + "name": "Product not found", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/products/:productId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products", + ":productId" + ], + "variable": [ + { + "key": "productId", + "value": "{{productId}}" + } + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "text", + "header": [], + "cookie": [], + "body": "" + } + ], + "event": [ + { + "listen": "test", + "script": { + "exec": [ + " \n// ********RoostGPT********\n/*\nTest generated by RoostGPT for test MiniProjects using AI Type Azure Open AI and AI Model roostgpt-4-32k\n\n\nTest generated for products/{productId} for http method type get in postman framework\n\n*/\n\n// ********RoostGPT********\n\n\nconst ld = require('lodash');\nlet responseData;\nconst contentType = pm.response.headers.get('Content-Type');\nif(contentType === \"application/xml\"){\n var parseString = require('xml2js').parseString;\n parseString(pm.response.body, function (err,result) {\n if (err) {\n console.error('Error parsing XML:', err);\n } else {\n responseData = result; \n }\n });\n} else{\n responseData = pm.response.json();\n}\nif (pm.variables.get(\"statusCode\")) {\n pm.expect(parseInt(pm.variables.get(\"statusCode\"))).to.be.equal(pm.response.code);\n}\n\nif (pm.response.code == 200){\n pm.test(\"successful operation\", function () {\n pm.expect(pm.response.status).to.be.eql(\"OK\");\n });\n\n}\n\nif (pm.response.code == 404){\n pm.test(\"Product not found\", function () {\n pm.expect(pm.response.status).to.be.eql(\"Not Found\");\n });\n\n}\n" + ], + "type": "text/javascript" + } + } + ] + }, + { + "name": "Updates a product in the store", + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"id\": {{id_*number}},\n \"name\": {{name_*date}},\n \"description\": {{description_*date}},\n \"price\": {{price_*number}}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/products/:productId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products", + ":productId" + ], + "variable": [ + { + "key": "productId", + "value": "{{productId}}", + "description": "ID of product that needs to be updated" + } + ] + }, + "description": "Updates a product in the store with form data" + }, + "response": [ + { + "name": "Updated Product", + "originalRequest": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"id\": {{id_*number}},\n \"name\": {{name_*date}},\n \"description\": {{description_*date}},\n \"price\": {{price_*number}}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/products/:productId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products", + ":productId" + ], + "variable": [ + { + "key": "productId", + "value": "{{productId}}" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "cookie": [], + "body": "{\n \"id\": 10,\n \"name\": \"updated apple\",\n \"description\": \"updated description of the product\",\n \"price\": 25\n}" + }, + { + "name": "Not Found", + "originalRequest": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"id\": {{id_*number}},\n \"name\": {{name_*date}},\n \"description\": {{description_*date}},\n \"price\": {{price_*number}}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/products/:productId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products", + ":productId" + ], + "variable": [ + { + "key": "productId", + "value": "{{productId}}" + } + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "text", + "header": [], + "cookie": [], + "body": "" + } + ], + "event": [ + { + "listen": "test", + "script": { + "exec": [ + " \n// ********RoostGPT********\n/*\nTest generated by RoostGPT for test MiniProjects using AI Type Azure Open AI and AI Model roostgpt-4-32k\n\n\nTest generated for products/{productId} for http method type put in postman framework\n\n*/\n\n// ********RoostGPT********\n\n\nconst ld = require('lodash');\nlet responseData;\nconst contentType = pm.response.headers.get('Content-Type');\nif(contentType === \"application/xml\"){\n var parseString = require('xml2js').parseString;\n parseString(pm.response.body, function (err,result) {\n if (err) {\n console.error('Error parsing XML:', err);\n } else {\n responseData = result; \n }\n });\n} else{\n responseData = pm.response.json();\n}\nif (pm.variables.get(\"statusCode\")) {\n pm.expect(parseInt(pm.variables.get(\"statusCode\"))).to.be.equal(pm.response.code);\n}\n\nif (pm.response.code == 200){\n pm.test(\"Updated Product\", function () {\n pm.expect(pm.response.status).to.be.eql(\"OK\");\n });\n\n}\n\nif (pm.response.code == 404){\n pm.test(\"Not Found\", function () {\n pm.expect(pm.response.status).to.be.eql(\"Not Found\");\n });\n\n}\n" + ], + "type": "text/javascript" + } + } + ] + }, + { + "name": "Deletes a product", + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{baseUrl}}/products/:productId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products", + ":productId" + ], + "variable": [ + { + "key": "productId", + "value": "{{productId}}", + "description": "Product id to delete" + } + ] + }, + "description": "delete a product" + }, + "response": [ + { + "name": "Product deleted", + "originalRequest": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{baseUrl}}/products/:productId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products", + ":productId" + ], + "variable": [ + { + "key": "productId", + "value": "{{productId}}" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "text", + "header": [], + "cookie": [], + "body": "" + }, + { + "name": "Not Found", + "originalRequest": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{baseUrl}}/products/:productId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "products", + ":productId" + ], + "variable": [ + { + "key": "productId", + "value": "{{productId}}" + } + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "text", + "header": [], + "cookie": [], + "body": "" + } + ], + "event": [ + { + "listen": "test", + "script": { + "exec": [ + " \n// ********RoostGPT********\n/*\nTest generated by RoostGPT for test MiniProjects using AI Type Azure Open AI and AI Model roostgpt-4-32k\n\n\nTest generated for products/{productId} for http method type delete in postman framework\n\n*/\n\n// ********RoostGPT********\n\n\nconst ld = require('lodash');\nlet responseData;\nconst contentType = pm.response.headers.get('Content-Type');\nif(contentType === \"application/xml\"){\n var parseString = require('xml2js').parseString;\n parseString(pm.response.body, function (err,result) {\n if (err) {\n console.error('Error parsing XML:', err);\n } else {\n responseData = result; \n }\n });\n} else{\n responseData = pm.response.json();\n}\nif (pm.variables.get(\"statusCode\")) {\n pm.expect(parseInt(pm.variables.get(\"statusCode\"))).to.be.equal(pm.response.code);\n}\n\nif (pm.response.code == 200){\n pm.test(\"Product deleted\", function () {\n pm.expect(pm.response.status).to.be.eql(\"OK\");\n });\n\n}\n\nif (pm.response.code == 404){\n pm.test(\"Not Found\", function () {\n pm.expect(pm.response.status).to.be.eql(\"Not Found\");\n });\n\n}\n" + ], + "type": "text/javascript" + } + } + ] + } + ] + } + ] +} \ No newline at end of file