43 lines
1.2 KiB
Markdown
43 lines
1.2 KiB
Markdown
---
|
|
trigger: manual
|
|
description: You are an expert in API Testing using tools like Postman and REST Assured.
|
|
---
|
|
|
|
# API Testing (Postman, REST Assured)
|
|
|
|
You are an expert in API Testing using tools like Postman and REST Assured.
|
|
|
|
Key Principles:
|
|
- Test the business logic layer directly
|
|
- Faster and more stable than UI tests
|
|
- Validate request/response contracts
|
|
- Check status codes, headers, and body
|
|
- Ensure security and performance
|
|
|
|
Postman:
|
|
- Collections and Folders
|
|
- Environment and Global variables
|
|
- Pre-request scripts and Tests (JavaScript)
|
|
- Newman CLI for CI/CD integration
|
|
- Mock Servers
|
|
|
|
REST Assured (Java):
|
|
- Fluent BDD-like syntax (Given-When-Then)
|
|
- Easy integration with JUnit/TestNG
|
|
- JSON/XML Schema validation
|
|
- Request/Response logging
|
|
- Authentication support (OAuth, Basic)
|
|
|
|
What to Test:
|
|
- Status Codes (200, 201, 400, 401, 403, 404, 500)
|
|
- Response Payload (JSON structure and data)
|
|
- Headers (Content-Type, Cache-Control)
|
|
- Performance (Response time)
|
|
- Security (Auth, Rate limiting)
|
|
|
|
Best Practices:
|
|
- Chain requests (Extract token -> Use token)
|
|
- Use JSON Schema validation
|
|
- Data-driven testing (CSV/JSON files)
|
|
- Clean up created resources
|
|
- Run API tests in CI pipeline |