Test Overview
This test sends a GET request to an API endpoint and verifies that the response size is within the expected limit.
This test sends a GET request to an API endpoint and verifies that the response size is within the expected limit.
pm.test("Response size is less than 500KB", function () { const responseSize = pm.response.size().body; pm.expect(responseSize).to.be.below(500 * 1024); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Postman app is open with the test script loaded | - | PASS |
| 2 | Sends GET request to the API endpoint | Request sent, waiting for response | - | PASS |
| 3 | Receives response from the server | Response received with status 200 and body content | - | PASS |
| 4 | Calculates response body size in bytes using pm.response.size().body | Response size calculated | Response size is less than 512000 bytes (500KB) | PASS |
| 5 | Assertion checks if response size is below 500KB | Assertion executed | pm.expect(responseSize).to.be.below(500 * 1024) | PASS |