Created
June 4, 2026 08:13
-
-
Save up1/e293e1d016414a2027b1017b0080671f to your computer and use it in GitHub Desktop.
Demo Postman
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pm.test("Status code is 200", function () { | |
| pm.response.to.have.status(200); | |
| }); | |
| pm.test("Response time is less than 1sec", function () { | |
| pm.expect(pm.response.responseTime).to.be.below(1000); | |
| }); | |
| pm.test("Response matches JSON schema", function () { | |
| const schema = { | |
| "type": "object", | |
| "required": ["id", "name", "username", "email", "address", "phone", "website", "company"], | |
| "properties": { | |
| "id": { "type": "number" }, | |
| "name": { "type": "string" }, | |
| "username": { "type": "string" }, | |
| "email": { "type": "string", "format": "email" }, | |
| "address": { | |
| "type": "object", | |
| "required": ["street", "suite", "city", "zipcode", "geo"], | |
| "properties": { | |
| "street": { "type": "string" }, | |
| "suite": { "type": "string" }, | |
| "city": { "type": "string" }, | |
| "zipcode": { "type": "string" }, | |
| "geo": { | |
| "type": "object", | |
| "required": ["lat", "lng"], | |
| "properties": { | |
| "lat": { "type": "string" }, | |
| "lng": { "type": "string" } | |
| } | |
| } | |
| } | |
| }, | |
| "phone": { "type": "string" }, | |
| "website": { "type": "string" }, | |
| "company": { | |
| "type": "object", | |
| "required": ["name", "catchPhrase", "bs"], | |
| "properties": { | |
| "name": { "type": "string" }, | |
| "catchPhrase": { "type": "string" }, | |
| "bs": { "type": "string" } | |
| } | |
| } | |
| } | |
| }; | |
| pm.response.to.have.jsonSchema(schema); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment