A comprehensive end-to-end API testing suite for a grocery store e-commerce platform. This collection demonstrates complete shopping flow automation including product browsing, cart management, order creation, and authentication workflows.
- Overview
- Features
- Prerequisites
- Installation
- Usage
- Test Coverage
- Environment Variables
- API Endpoints
- Running Tests
- Testing Data
- Security Notes
- Troubleshooting
- Author
This project provides a complete testing framework for the Simple Grocery Store API, covering the entire e-commerce customer journey from product discovery to order completion. The collection includes 45 automated tests with dynamic data generation and environment variable management.
- ✅ Complete E-commerce Flow - Tests cover the full shopping experience
- ✅ Dynamic Authentication - Automatic client registration with unique email generation
- ✅ Cart Management - Create, modify, and manage shopping cart operations
- ✅ Order Lifecycle - Complete order creation, retrieval, update, and deletion
- ✅ Product Catalog - Comprehensive product browsing with filters
- ✅ Automated Cleanup - Validates proper deletion with 404 verification
- ✅ Environment Management - Dynamic variable storage for seamless test execution
- ✅ Extensive Validation - 45 test assertions covering all scenarios
- Postman - Desktop application or web version
- Node.js - For running Newman CLI (optional)
- Newman - Postman's command-line runner (optional)
# Install Newman globally (optional)
npm install -g newman- Download
simple-grocery-store-api-collection.json - Open Postman
- Click Import button
- Select the downloaded file
- Collection will appear in your workspace
# Clone the repository
git clone https://github.com/tyraelw/simple-grocery-store-api-testing.git
# Navigate to the directory
cd simple-grocery-store-api-testing- Import the collection as described above
- Select the collection in Postman
- Click Run collection
- Configure run settings (iterations, delay, etc.)
- Click Run Simple Grocery Store API
- View detailed test results in the runner
# Run the entire collection
newman run simple-grocery-store-api-collection.json
# Run with detailed output
newman run simple-grocery-store-api-collection.json --reporters cli,json
# Run with HTML report
newman run simple-grocery-store-api-collection.json --reporters cli,html --reporter-html-export report.html
# Run with environment file
newman run simple-grocery-store-api-collection.json \
--environment simple-grocery-store-environment.json \
--reporters cli,htmlextra \
--reporter-htmlextra-export report.html| Category | Endpoints | Tests | Coverage |
|---|---|---|---|
| API Status | 1 | 2 | ✅ 100% |
| Products | 5 | 17 | ✅ 100% |
| Cart Management | 6 | 12 | ✅ 100% |
| Authentication | 1 | 3 | ✅ 100% |
| Orders | 5 | 11 | ✅ 100% |
| Total | 18 | 45 | ✅ 100% |
- API health check validation
- Retrieve all products with pagination
- Filter by category (coffee, fresh-produce, meat-seafood)
- Filter by availability (in stock)
- Limit results (pagination)
- Get single product details
- Validate product schema and data types
- Create new shopping cart
- Add items to cart
- Modify item quantities
- Replace items in cart
- Delete items from cart
- Retrieve cart contents
- Get all cart items
- Register API client with dynamic email
- Generate and store access token
- Validate Bearer token authentication
- Email uniqueness with timestamp generation
- Create order from cart
- Retrieve all orders
- Get single order details
- Update order information
- Delete order
- Verify 404 on deleted order
The collection uses environment variables for dynamic data management:
| Variable | Description | Example |
|---|---|---|
| baseUrl | API base URL | https://simple-grocery-store-api.glitch.me |
| cartId | Shopping cart identifier | Auto-generated |
| accessToken | Authentication token | Auto-generated |
| orderId | Order identifier | Auto-generated |
| clientEmail | Unique client email | test1234567890@example.com |
The collection automatically generates:
- Unique Emails: Using timestamp (
test${Date.now()}@example.com) - Customer Names: Using Postman's
$randomFullNamevariable - Cart IDs: Saved from API response
- Access Tokens: Generated during client registration
- Order IDs: Stored from order creation
https://simple-grocery-store-api.glitch.me
GET /status- Check API health
GET /products- Get all productsGET /products?category={category}- Filter by categoryGET /products?results={limit}- Limit resultsGET /products?available=true- Filter available productsGET /products/{productId}- Get product details
POST /carts- Create new cartGET /carts/{cartId}- Get cartGET /carts/{cartId}/items- Get cart itemsPOST /carts/{cartId}/items- Add item to cartPATCH /carts/{cartId}/items/{itemId}- Modify itemPUT /carts/{cartId}/items/{itemId}- Replace itemDELETE /carts/{cartId}/items/{itemId}- Delete item
POST /api-clients- Register client
POST /orders- Create orderGET /orders- Get all ordersGET /orders/{orderId}- Get single orderPATCH /orders/{orderId}- Update orderDELETE /orders/{orderId}- Delete order
The collection is designed to run sequentially as tests depend on previous responses:
- API Status check
- Product browsing and filtering
- Cart creation and management
- Client registration
- Order creation and lifecycle
- Cleanup verification
You can also test individual endpoints, but ensure:
- Cart ID exists for cart operations
- Access token is generated for order operations
- Order ID exists for order-specific operations
This collection uses generic test data for demonstration purposes:
- Client Name: "API Test Client"
- Customer Names: Randomly generated using Postman variables
- Emails: Dynamically generated with timestamps for uniqueness
- Product IDs: Standard test products from the API
All test data is generated dynamically and cleaned up after execution.
- ✅ No hardcoded credentials in the collection
- ✅ Access tokens are generated dynamically
- ✅ Email addresses use timestamp for uniqueness
- ✅ Bearer token authentication properly implemented
- ✅ All sensitive data stored in environment variables
Issue: Tests fail due to missing cart ID
Solution: Ensure "Create a new cart" request runs first
Issue: Authentication errors on order endpoints
Solution: Run "Register API Client" to generate fresh access token
Issue: 404 errors on specific products
Solution: Check product availability with "Get all products" first
Issue: Rate limiting errors
Solution: Add delay between requests in collection runner
- Cypress E-Commerce Testing - End-to-end UI automation with Page Object Model
- Trello API Testing Suite - CRUD operations and board management testing
Isrrael Andres Toro Alvarez
- GitHub: @tyraelw
- LinkedIn: Isrrael Toro Alvarez
- Email: tyrael78w@gmail.com
For questions, feedback, or collaboration opportunities, please reach out via tyrael78w@gmail.com
⭐ If you find this project useful, please consider giving it a star on GitHub!