Overview
Testing is a critical part of the URL Shortener API to ensure reliability, scalability, and correctness before deployment. The objective is to verify that all application components behave as expected under normal usage, edge cases, and high-load scenarios.
This strategy covers:
- Unit testing
- Functional / integration testing
- API testing
- Collision + determinism testing (short-code generation)
- Stress testing (service-level)
- Validation + security testing
Testing objectives
- Verify short codes are generated correctly
- Verify URLs are shortened successfully
- Verify redirects function correctly
- Verify invalid inputs are rejected
- Verify collision handling works correctly (including DB uniqueness constraints)
- Verify hash generation remains deterministic across environments
- Verify the API performs reliably under load
Testing Tools
| Tool |
Purpose |
| Jest |
Unit tests + collision/determinism tests |
| Node.js |
Test Runtime |
| Supertest / Postman |
API endpoint testing |
| Browser |
Manual redirect verification |
| MongoDB Atlas / local MongoDB |
Database validation, unique index enforcement, integration testing |
Test architecture (project layout)