Back to All Questions
Question 44 of 100
Intermediate API Testing
Intermediate
Q44: What are Common Postman Test Assertions?
đź“‹Core Concept
What are Common Postman Test Assertions?
Key Takeaways & Architecture Summary
- ✓Status code validation: pm.response.to.have.status(200).
- ✓Response header validation: pm.response.headers.to.have.property().
- ✓SLA performance checks: pm.expect(responseTime).to.be.below(500).
- ✓Exact string matching: pm.expect(statusText).to.equal("Created").
Direct Answer Summary
Common Postman assertions validate essential properties of the response contract, including status code structures, payload data types, expected headers (e.g., Content-Type), and SLA performance thresholds.
⚠️ Senior Engineering Warning (Red Flag)
Do not hardcode your response latency SLAs too tightly. Setting assertions like responseTime < 100ms can lead to flaky test failures due to minor network shifts or server load spikes.
đź’ˇ STAR Architectural Explanation & Pro Tip
Grouping these basic validations into shared assertion libraries ensures that every endpoint in your suite respects the same baseline security and performance standards.
RestAssuredTest.java
Rest-Assured + Java// Common Postman assertion patterns
pm.test("Validate core HTTP metadata", function () {
pm.response.to.have.status(200);
pm.response.to.have.header("Content-Type", "application/json; charset=utf-8");
pm.expect(pm.response.responseTime).to.be.below(1000);
});