Commit 9c399c48 authored by Gourav More's avatar Gourav More
Browse files

Issue #KN-15 fix:Postman search-service API Negative test cases

Showing with 410 additions and 10 deletions
+410 -10
......@@ -303,6 +303,218 @@
}
}
]
},
{
"name": "Negative",
"item": [
{
"name": "400 - Search filters missing",
"event": [
{
"listen": "test",
"script": {
"exec": [
"let jsonResponse = pm.response.json()",
"",
"//Verification",
"pm.test(\"Status code is 400\", () => {",
" pm.response.to.have.status(400)",
"});",
"//code name contains a string",
"tests[\"Status code name has string \\\"Bad Request\\\"\"] = responseCode.name.has(\"Bad Request\");",
"",
"pm.test(\"Verify keys and data type of the response result\", () => {",
" pm.expect(jsonResponse.result).to.be.an(\"object\");",
"});",
"",
"//Validation",
"// Response body",
"pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {",
" pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");",
"});",
"",
"// Params",
"pm.test(\"params.err should be \\\"ERR_CONTENT_SEARCH_FIELDS_MISSING\\\"\", () => {",
" pm.expect(jsonResponse.params.err).to.eql(\"ERR_CONTENT_SEARCH_FIELDS_MISSING\");",
"});",
"pm.test(\"params.errmsg should be \\\"Required fields for search content are missing\\\"\", () => {",
" pm.expect(jsonResponse.params.errmsg).to.eql(\"Required fields for search content are missing\");",
"});"
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"connection": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Authenticated-User-token",
"value": "{{keycloak_access_token}}"
},
{
"key": "Authorization",
"value": "{{kong_api_key}}"
},
{
"key": "X-Channel-Id",
"value": "{{channel_id}}",
"type": "text",
"disabled": true
}
],
"body": {
"mode": "raw",
"raw": "{\n \"request\": {\n }\n}"
},
"url": {
"raw": "{{host}}/action/composite/v3/search",
"host": [
"{{host}}"
],
"path": [
"action",
"composite",
"v3",
"search"
]
},
"description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty."
},
"response": []
},
{
"name": "500 - parameter cannot be negative",
"event": [
{
"listen": "test",
"script": {
"exec": [
"let jsonResponse = pm.response.json()",
"",
"//Verification",
"pm.test(\"Status code is 500\", () => {",
" pm.response.to.have.status(500)",
"});",
"",
"pm.test(\"Verify keys and data type of the response result\", () => {",
" pm.expect(jsonResponse.result).to.be.an(\"object\");",
"});",
"",
"//Validation",
"// Response body",
"pm.test(\"responseCode should be \\\"SERVER_ERROR\\\"\", () => {",
" pm.expect(jsonResponse.responseCode).to.eql(\"SERVER_ERROR\");",
"});",
"",
"// Params",
"pm.test(\"params.err should be \\\"ERR_SYSTEM_EXCEPTION\\\"\", () => {",
" pm.expect(jsonResponse.params.err).to.eql(\"ERR_SYSTEM_EXCEPTION\");",
"});",
"pm.test(\"params.errmsg should be \\\"[size] parameter cannot be negative, found [-1]\\\"\", () => {",
" pm.expect(jsonResponse.params.errmsg).to.eql(\"[size] parameter cannot be negative, found [-1]\");",
"});"
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"connection": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Authenticated-User-token",
"value": "{{keycloak_access_token}}"
},
{
"key": "Authorization",
"value": "{{kong_api_key}}"
},
{
"key": "X-Channel-Id",
"value": "{{channel_id}}",
"type": "text",
"disabled": true
}
],
"body": {
"mode": "raw",
"raw": "{\n \"request\": {\n \"filters\": {\n \"objectType\": [\n \"AssessmentItem\"\n ],\n \"status\": [\n \"Live\"\n ]\n },\n \"sort_by\": {\n \"lastUpdatedOn\": \"desc\"\n },\n \"limit\": -1\n }\n}"
},
"url": {
"raw": "{{host}}/action/composite/v3/search",
"host": [
"{{host}}"
],
"path": [
"action",
"composite",
"v3",
"search"
]
},
"description": "This API is associated with batch creation\nThe endpoint for Creates a Batch is /batch/create\nThe fields marked with an asterisk (*) are mandatory. They cannot be null or empty."
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"let jsonResponse = pm.response.json();",
"",
"pm.test(\"Verify keys and data type of the params in negative scenario\", () => {",
" pm.expect(jsonResponse.params.resmsgid).to.be.a(\"string\");",
" pm.expect(jsonResponse.params.msgid).to.be.null;",
" pm.expect(jsonResponse.params.err).to.be.a(\"string\");",
" pm.expect(jsonResponse.params.status).to.be.a(\"string\");",
" pm.expect(jsonResponse.params.errmsg).to.be.a(\"string\");",
"});",
"",
"pm.test(\"params.status should be \\\"failed\\\"\", () => {",
" pm.expect(jsonResponse.params.status).to.eql(\"failed\");",
"});",
"",
"pm.test(\"id should be api.v1.search\", () => {",
" pm.expect(jsonResponse.id).to.eql(\"api.v1.search\");",
"});",
"pm.test(\"ver should be 1.0\", () => {",
" pm.expect(jsonResponse.ver).to.eql(\"1.0\");",
"});"
]
}
}
]
}
],
"event": [
......
{
"id": "cf102fa4-c8e2-4199-a6e6-6a04dae9262d",
"id": "320b48d5-cb8d-48c0-a7b9-3743821dbd86",
"name": "Composite Search API",
"timestamp": "2022-11-16T06:10:20.538Z",
"timestamp": "2022-11-18T04:22:08.826Z",
"collection_id": "65bcacf8-0c90-4f3f-874b-a5d2c01cdc36",
"folder_id": 0,
"environment_id": "43ba92f2-e81b-446b-8b2a-589126842629",
"totalPass": 36,
"totalPass": 59,
"totalFail": 0,
"results": [
{
"id": "6c4437c8-62ec-4917-bc5a-838fd333b71c",
"name": "200 - Get live Content list",
"url": "https://dev.knowlg.sunbird.org//action/composite/v3/search",
"time": 727,
"time": 2389,
"responseCode": {
"code": 200,
"name": "OK"
......@@ -77,7 +77,7 @@
}
},
"times": [
727
2389
],
"allTests": [
{
......@@ -99,7 +99,7 @@
"id": "eaba0158-fbb9-480a-8971-e5f4aad1fc47",
"name": "200 - Get live Assesment list",
"url": "https://dev.knowlg.sunbird.org//action/composite/v3/search",
"time": 323,
"time": 303,
"responseCode": {
"code": 200,
"name": "OK"
......@@ -164,7 +164,7 @@
}
},
"times": [
323
303
],
"allTests": [
{
......@@ -186,7 +186,7 @@
"id": "97be2029-e5dc-4dcd-8736-9178818022cf",
"name": "200 - Get live assets list",
"url": "https://dev.knowlg.sunbird.org//action/composite/v3/search",
"time": 268,
"time": 285,
"responseCode": {
"code": 200,
"name": "OK"
......@@ -251,7 +251,7 @@
}
},
"times": [
268
285
],
"allTests": [
{
......@@ -268,10 +268,190 @@
"ver should be 1.0": true
}
]
},
{
"id": "74f75390-3349-4cff-b105-20788af46c95",
"name": "400 - Search filters missing",
"url": "https://dev.knowlg.sunbird.org//action/composite/v3/search",
"time": 290,
"responseCode": {
"code": 400,
"name": "Bad Request"
},
"tests": {
"Content-Type header is present": true,
"Validate keys and data type of the response body": true,
"Verify keys and data type of the params in negative scenario": true,
"params.status should be \"failed\"": true,
"id should be api.v1.search": true,
"ver should be 1.0": true,
"Status code is 400": true,
"Verify keys and data type of the response result": true,
"responseCode should be \"CLIENT_ERROR\"": true,
"params.err should be \"ERR_CONTENT_SEARCH_FIELDS_MISSING\"": true,
"params.errmsg should be \"Required fields for search content are missing\"": true,
"Status code name has string \"Bad Request\"": true
},
"testPassFailCounts": {
"Content-Type header is present": {
"pass": 1,
"fail": 0
},
"Validate keys and data type of the response body": {
"pass": 1,
"fail": 0
},
"Verify keys and data type of the params in negative scenario": {
"pass": 1,
"fail": 0
},
"params.status should be \"failed\"": {
"pass": 1,
"fail": 0
},
"id should be api.v1.search": {
"pass": 1,
"fail": 0
},
"ver should be 1.0": {
"pass": 1,
"fail": 0
},
"Status code is 400": {
"pass": 1,
"fail": 0
},
"Verify keys and data type of the response result": {
"pass": 1,
"fail": 0
},
"responseCode should be \"CLIENT_ERROR\"": {
"pass": 1,
"fail": 0
},
"params.err should be \"ERR_CONTENT_SEARCH_FIELDS_MISSING\"": {
"pass": 1,
"fail": 0
},
"params.errmsg should be \"Required fields for search content are missing\"": {
"pass": 1,
"fail": 0
},
"Status code name has string \"Bad Request\"": {
"pass": 1,
"fail": 0
}
},
"times": [
290
],
"allTests": [
{
"Content-Type header is present": true,
"Validate keys and data type of the response body": true,
"Verify keys and data type of the params in negative scenario": true,
"params.status should be \"failed\"": true,
"id should be api.v1.search": true,
"ver should be 1.0": true,
"Status code is 400": true,
"Verify keys and data type of the response result": true,
"responseCode should be \"CLIENT_ERROR\"": true,
"params.err should be \"ERR_CONTENT_SEARCH_FIELDS_MISSING\"": true,
"params.errmsg should be \"Required fields for search content are missing\"": true,
"Status code name has string \"Bad Request\"": true
}
]
},
{
"id": "8fb24515-12e0-430f-af59-7837ed777afb",
"name": "500 - parameter cannot be negative",
"url": "https://dev.knowlg.sunbird.org//action/composite/v3/search",
"time": 255,
"responseCode": {
"code": 500,
"name": "Internal Server Error"
},
"tests": {
"Content-Type header is present": true,
"Validate keys and data type of the response body": true,
"Verify keys and data type of the params in negative scenario": true,
"params.status should be \"failed\"": true,
"id should be api.v1.search": true,
"ver should be 1.0": true,
"Status code is 500": true,
"Verify keys and data type of the response result": true,
"responseCode should be \"SERVER_ERROR\"": true,
"params.err should be \"ERR_SYSTEM_EXCEPTION\"": true,
"params.errmsg should be \"[size] parameter cannot be negative, found [-1]\"": true
},
"testPassFailCounts": {
"Content-Type header is present": {
"pass": 1,
"fail": 0
},
"Validate keys and data type of the response body": {
"pass": 1,
"fail": 0
},
"Verify keys and data type of the params in negative scenario": {
"pass": 1,
"fail": 0
},
"params.status should be \"failed\"": {
"pass": 1,
"fail": 0
},
"id should be api.v1.search": {
"pass": 1,
"fail": 0
},
"ver should be 1.0": {
"pass": 1,
"fail": 0
},
"Status code is 500": {
"pass": 1,
"fail": 0
},
"Verify keys and data type of the response result": {
"pass": 1,
"fail": 0
},
"responseCode should be \"SERVER_ERROR\"": {
"pass": 1,
"fail": 0
},
"params.err should be \"ERR_SYSTEM_EXCEPTION\"": {
"pass": 1,
"fail": 0
},
"params.errmsg should be \"[size] parameter cannot be negative, found [-1]\"": {
"pass": 1,
"fail": 0
}
},
"times": [
255
],
"allTests": [
{
"Content-Type header is present": true,
"Validate keys and data type of the response body": true,
"Verify keys and data type of the params in negative scenario": true,
"params.status should be \"failed\"": true,
"id should be api.v1.search": true,
"ver should be 1.0": true,
"Status code is 500": true,
"Verify keys and data type of the response result": true,
"responseCode should be \"SERVER_ERROR\"": true,
"params.err should be \"ERR_SYSTEM_EXCEPTION\"": true,
"params.errmsg should be \"[size] parameter cannot be negative, found [-1]\"": true
}
]
}
],
"count": 1,
"totalTime": 1318,
"totalTime": 3522,
"collection": {
"requests": [
{
......@@ -285,6 +465,14 @@
{
"id": "97be2029-e5dc-4dcd-8736-9178818022cf",
"method": "POST"
},
{
"id": "74f75390-3349-4cff-b105-20788af46c95",
"method": "POST"
},
{
"id": "8fb24515-12e0-430f-af59-7837ed777afb",
"method": "POST"
}
]
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment