{"info":{"_postman_id":"d66160de-be16-4e0c-aa87-a2eb79d55141","name":"Predator Tests Examples","description":"<html><head></head><body><p>This collection provides simple tests creation for prodator via predetors API</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"220627","collectionId":"d66160de-be16-4e0c-aa87-a2eb79d55141","publishedId":"S1TYTvP2","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2019-06-05T06:00:16.000Z"},"item":[{"name":"One scenario with capture","id":"e0aeda86-7445-4b5b-b828-65173048dbfa","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"name\": \"Simple test\",\n  \"description\": \"This test has one scenario, that created an order, and then gets it.\",\n  \"type\": \"basic\",\n  \"artillery_test\": {\n    \"config\": {\n      \"target\": \"http://pets-store.default\"\n    },\n    \"scenarios\": [\n      {\n        \"name\": \"Create order, get order\",\n        \"weight\": 100,\n        \"flow\": [\n          {\n            \"post\": {\n              \"url\": \"/orders\",\n              \"headers\": {},\n              \"json\": {\n                \"name\": \"first order\",\n                \"address\": \"tel aviv\",\n                \"products\": [\n                  {\n                    \"product_id\": \"7f64e64-6ae9-47fd-95eb-86a00dca1613\",\n                    \"quantitiy\": 1\n                  }\n                ]\n              },\n              \"capture\": [\n                {\n                  \"json\": \"$.order_id\",\n                  \"as\": \"orderId\"\n                }\n              ]\n            }\n          },\n          {\n            \"get\": {\n              \"url\": \"/orders/{{orderId}}\"\n            }\n          }\n        ]\n      }\n    ]\n  }\n}"},"url":"{{baseUrl}}/v1/tests","description":"<p>This is an example of test creation with:</p>\n<ol>\n<li>One scenario</li>\n<li>Flow</li>\n<li>Capture</li>\n</ol>\n","urlObject":{"path":["v1","tests"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e0aeda86-7445-4b5b-b828-65173048dbfa"},{"name":"Two scenarios weight and functions","id":"ed82d899-bb06-4772-b48c-1cb48a43b0f7","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"name\": \"Weights and Functions\",\n  \"description\": \"Two scenarios - One creates order and get it, second adds new product\",\n  \"type\": \"basic\",\n  \"artillery_test\": {\n    \"config\": {\n      \"target\": \"http://pets-store.default\"\n    },\n    \"scenarios\": [\n      {\n        \"name\": \"Create order and get it\",\n        \"weight\": 80,\n        \"flow\": [\n          {\n            \"post\": {\n              \"url\": \"/orders\",\n              \"headers\": {\n                \"x-request-id\": \"{{ $randomString() }}\"\n              },\n              \"json\": {\n                \"name\": \"first order\",\n                \"address\": \"tel aviv\",\n                \"products\": [\n                  {\n                    \"product_id\": \"7f64e64-6ae9-47fd-95eb-86a00dca1613\",\n                    \"quantitiy\": 1\n                  }\n                ]\n              },\n              \"capture\": [\n                {\n                  \"json\": \"$.order_id\",\n                  \"as\": \"orderId\"\n                }\n              ],\n              \"forever\": true\n            }\n          },\n          {\n            \"get\": {\n              \"url\": \"/orders/{{orderId}}\",\n              \"headers\": {\n                \"x-request-id\": \"{{ $randomString() }}\"\n              },\n              \"capture\": [],\n              \"forever\": true\n            }\n          }\n        ]\n      },\n      {\n        \"name\": \"Add new product\",\n        \"weight\": 20,\n        \"flow\": [\n          {\n            \"post\": {\n              \"url\": \"/products\",\n              \"headers\": {},\n              \"json\": {\n                \"name\": \"{{ $randomString() }}\",\n                \"type\": \"food\"\n              },\n              \"forever\": true\n            }\n          }\n        ]\n      }\n    ]\n  }\n}\n"},"url":"{{baseUrl}}/v1/tests","description":"<p>This is an example of test creation with:</p>\n<ol>\n<li>Two scenarios</li>\n<li>weights</li>\n<li>functions</li>\n</ol>\n","urlObject":{"path":["v1","tests"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"ed82d899-bb06-4772-b48c-1cb48a43b0f7"},{"name":"Before tests request","id":"3cdb12df-f49e-4a38-bf43-84feb79e06ae","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"name\": \"Before test\",\n  \"description\": \"Login one time before test starts and use the session token\",\n  \"type\": \"basic\",\n  \"artillery_test\": {\n    \"config\": {\n      \"target\": \"http://pets-store.default\"\n    },\n    \"before\": {\n      \"flow\": [\n        {\n          \"post\": {\n            \"url\": \"/login\",\n            \"headers\": {},\n            \"json\": {\n              \"user\": \"mickey\",\n              \"password\": \"123456\"\n            },\n            \"capture\": [\n              {\n                \"json\": \"$.token\",\n                \"as\": \"token-session\"\n              }\n            ],\n            \"forever\": true\n          }\n        }\n      ]\n    },\n    \"scenarios\": [\n      {\n        \"name\": \"Create order and get it\",\n        \"weight\": 80,\n        \"flow\": [\n          {\n            \"post\": {\n              \"url\": \"/orders\",\n              \"headers\": {\n                \"x-request-id\": \"{{ $randomString() }}\"\n              },\n              \"json\": {\n                \"name\": \"first order\",\n                \"address\": \"tel aviv\",\n                \"products\": [\n                  {\n                    \"product_id\": \"7f64e64-6ae9-47fd-95eb-86a00dca1613\",\n                    \"quantitiy\": 1\n                  }\n                ]\n              },\n              \"capture\": [\n                {\n                  \"json\": \"$.order_id\",\n                  \"as\": \"orderId\"\n                }\n              ],\n              \"forever\": true\n            }\n          },\n          {\n            \"get\": {\n              \"url\": \"/orders/{{orderId}}\",\n              \"headers\": {\n                \"x-request-id\": \"{{ $randomString() }}\"\n              },\n              \"capture\": [],\n              \"forever\": true\n            }\n          }\n        ]\n      },\n      {\n        \"name\": \"Add new product\",\n        \"weight\": 20,\n        \"flow\": [\n          {\n            \"post\": {\n              \"url\": \"/products\",\n              \"headers\": {\n                \"token-id\": \"{{token-session}}\"\n              },\n              \"json\": {\n                \"name\": \"{{ $randomString() }}\",\n                \"type\": \"food\"\n              },\n              \"capture\": [],\n              \"forever\": true\n            }\n          }\n        ]\n      }\n    ]\n  }\n}\n"},"url":"{{baseUrl}}/v1/tests","description":"<p>This is an example of test creation with:</p>\n<ol>\n<li>before test</li>\n</ol>\n","urlObject":{"path":["v1","tests"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"3cdb12df-f49e-4a38-bf43-84feb79e06ae"},{"name":"Custom javascript","id":"64cb4ff2-602d-4a2d-a674-cfb124d9bb74","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"name\": \"Custom javascript\",\n  \"description\": \"Using processor file, call to custom javacript functions\",\n  \"type\": \"basic\",\n  \"processor_file_url\": \"https://www.dropbox.com/s/ny0eqs54ohub78l/predator_processor_workshop.txt?dl=1\",\n  \"artillery_test\": {\n    \"config\": {\n      \"target\": \"http://pets-store.default\"\n    },\n    \"before\": {\n      \"flow\": [{\n        \"post\": {\n          \"url\": \"/login\",\n          \"headers\": {},\n          \"json\": {\n            \"user\": \"mickey\",\n            \"password\": \"123456\"\n          },\n          \"capture\": [{\n            \"json\": \"$.token\",\n            \"as\": \"token-session\"\n          }],\n          \"forever\": true\n        }\n      }]\n    },\n    \"scenarios\": [{\n      \"name\": \"Scenario 1\",\n      \"weight\": 80,\n      \"flow\": [{\n        \"function\": \"getValidCityGlobal\"\n      },\n        {\n          \"post\": {\n            \"url\": \"/orders\",\n            \"beforeRequest\": \"generateStatusCode\",\n            \"afterResponse\": \"logErrorResponse\",\n            \"headers\": {\n              \"x-request-id\": \"{{ $randomString() }}\",\n              \"response-status\": \"{{ statusCode }}\"\n            },\n            \"json\": {\n              \"name\": \"first order\",\n              \"address\": \"{{ cityName }}\",\n              \"products\": [{\n                \"product_id\": \"7f64e64-6ae9-47fd-95eb-86a00dca1613\",\n                \"quantitiy\": 1\n              }]\n            },\n            \"capture\": [{\n              \"json\": \"$.order_id\",\n              \"as\": \"orderId\"\n            }],\n            \"forever\": true\n          }\n        },\n        {\n          \"log\": \"********************* Sent a request to /orders with address {{ cityName }}\"\n        },\n        {\n          \"get\": {\n            \"url\": \"/orders/{{orderId}}\",\n            \"headers\": {\n              \"x-request-id\": \"{{ $randomString() }}\"\n            },\n            \"capture\": [],\n            \"forever\": true\n          }\n        }\n      ]\n    },\n      {\n        \"name\": \"Scenario 2\",\n        \"weight\": 20,\n        \"flow\": [{\n          \"post\": {\n            \"url\": \"/products\",\n            \"headers\": {\n              \"token-id\": \"{{token-session}}\"\n            },\n            \"json\": {\n              \"name\": \"{{ $randomString() }}\",\n              \"type\": \"food\"\n            },\n            \"forever\": true\n          }\n        }]\n      }\n    ]\n  }\n}\n"},"url":"{{baseUrl}}/v1/tests","description":"<p>Check docs: <a href=\"https://zooz.github.io/predator/tests.html#creating-a-test-with-custom-logic-in-javascript\">https://zooz.github.io/predator/tests.html#creating-a-test-with-custom-logic-in-javascript</a></p>\n","urlObject":{"path":["v1","tests"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"64cb4ff2-602d-4a2d-a674-cfb124d9bb74"},{"name":"Create order dsl","id":"2ff0a78e-c161-4db2-9169-0d63759f59c2","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"name\": \"create_order\",\n    \"request\": {\n        \"post\": {\n            \"json\": {\n                \"name\": \"order name\",\n                \"address\": \"address\",\n                \"products\": [\n                    {\n                        \"product_name\": \"cat food\",\n                        \"product_id\": \"{{ $uuid() }}\"\n                    }\n                ]\n            },\n            \"url\": \"http://pets-store.default/orders\",\n            \"captures\": [\n                {\n                    \"json\": \"$order_id\",\n                    \"as\": \"order_id\"\n                }\n            ]\n        }\n    }\n}"},"url":"{{baseUrl}}/v1/dsl/pets/definitions","description":"<p>Check docs: <a href=\"https://zooz.github.io/predator/tests.html#request-reuse-with-dsl-definitions\">https://zooz.github.io/predator/tests.html#request-reuse-with-dsl-definitions</a></p>\n","urlObject":{"path":["v1","dsl","pets","definitions"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"2ff0a78e-c161-4db2-9169-0d63759f59c2"},{"name":"Get order dsl","id":"fb0104c5-8aae-46db-9fd0-227b14829c9f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"name\":\"get_order\",\n    \"request\": {\n        \"get\":{\n            \"url\":\"http://pets-store.default/orders/{{ order_id }}\"\n        }\n    }\n}"},"url":"{{baseUrl}}/v1/dsl/pets/definitions","urlObject":{"path":["v1","dsl","pets","definitions"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"fb0104c5-8aae-46db-9fd0-227b14829c9f"},{"name":"DSL Test","id":"48825c96-6cb3-481b-93b8-0b694699e6db","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"name\": \"Pets Strore using DSL\",\n    \"description\": \"Create order, and get order using dsl blocks\",\n    \"type\": \"dsl\",\n    \"config\": {\n        \"target\": \"http://pets-store.default\"\n    },\n    \"scenarios\": [\n        {\n            \"scenario_name\": \"create order scenario\",\n            \"weight\": 100,\n            \"steps\": [\n                {\n                    \"action\": \"pets.create_order\"\n                },\n                {\n                    \"action\": \"pets.get_order\"\n                }\n            ]\n        }\n    ]\n}"},"url":"{{baseUrl}}/v1/tests","urlObject":{"path":["v1","tests"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"48825c96-6cb3-481b-93b8-0b694699e6db"}],"event":[{"listen":"prerequest","script":{"id":"7b173472-19e7-4b00-9a34-298a5e68f029","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"ce2d8410-8681-4a0d-9cc3-e5bfd34dfd20","type":"text/javascript","exec":[""]}}]}