Test Overview
This test checks if Postman can perform non-functional testing by measuring response time and validating server performance under load.
This test checks if Postman can perform non-functional testing by measuring response time and validating server performance under load.
import requests import time def test_response_time(): url = "https://api.example.com/data" start_time = time.time() response = requests.get(url) end_time = time.time() response_time = end_time - start_time assert response.status_code == 200, f"Expected status 200 but got {response.status_code}" assert response_time < 0.5, f"Response time too high: {response_time}s" if __name__ == "__main__": test_response_time()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test environment ready, network available | — | PASS |
| 2 | Send GET request to https://api.example.com/data | Request sent, waiting for response | — | PASS |
| 3 | Receive response with status code 200 | Response received with data payload | Check if status code == 200 | PASS |
| 4 | Measure response time | Response time calculated as 0.3 seconds | Verify response time < 0.5 seconds | PASS |
| 5 | Test ends with all assertions passed | Test completed successfully | — | PASS |
pm.test('API is fast', () => {
pm.expect(pm.response.responseTime).to.be.below(200);
});pm.test('Security headers present', () => {
pm.expect(pm.response.headers.has('Content-Security-Policy')).to.equal(true
});Pass the test and this pattern moves unknown