Tools & Technologies
I use Postman as my primary tool for API testing, leveraging its powerful features for creating test collections, environment management, and automated test execution through Newman CLI.
API Test Coverage
Sample API endpoints tested as part of the e-commerce platform testing:
User Authentication
Validates user login with email and password credentials.
- Successful login with valid credentials
- Error response for invalid email format
- Error response for wrong password
- Response time under 500ms
Product Listing
Retrieves paginated list of products with filtering options.
- Returns 200 status code
- Response contains product array
- Pagination parameters work correctly
- Filter by category returns correct items
Add to Cart
Adds a product to the user's shopping cart.
- Product added successfully (201 status)
- Cart total updates correctly
- Duplicate product increases quantity
- Invalid product ID returns 404
Update Cart Item
Updates quantity of an item in the cart.
- Quantity updates successfully
- Zero quantity removes item
- Invalid quantity returns validation error
Remove from Cart
Removes an item from the shopping cart.
- Item removed successfully (200 status)
- Cart total recalculates
- Non-existent item returns 404
Test Scripts Example
Postman test scripts using JavaScript for automated validation:
// Test: Validate successful login response
pm.test("Status code is 200", function() {
pm.response.to.have.status(200);
});
pm.test("Response contains auth token", function() {
const jsonData = pm.response.json();
pm.expect(jsonData).to.have.property('token');
pm.expect(jsonData.token).to.be.a('string');
// Save token for subsequent requests
pm.environment.set("authToken", jsonData.token);
});
pm.test("Response time is acceptable", function() {
pm.expect(pm.response.responseTime).to.be.below(500);
});
pm.test("User data is returned", function() {
const jsonData = pm.response.json();
pm.expect(jsonData.user).to.have.property('id');
pm.expect(jsonData.user).to.have.property('email');
});
Environment Management
Using Postman environments to manage different testing configurations:
Development Environment
Local development server with test database for rapid iteration and debugging.
Staging Environment
Pre-production environment mirroring production setup for final validation.
Production Environment
Live environment for smoke tests and monitoring (read-only operations).
Newman CLI Integration
Automated API test execution using Newman for CI/CD integration:
# Run API tests with Newman
newman run collection.json \
-e environment.json \
--reporters cli,htmlextra \
--reporter-htmlextra-export ./reports/api-report.html
# Run with multiple iterations
newman run collection.json \
-e environment.json \
-d testdata.csv \
-n 5