8 / 8 · Book 14 · Exercises · drill: interview Q&A← prev⊞ allGet the book →
1.16The Hybrid Approach
Many teams use both tools effectively:
- Postman + Newman for smoke tests and quick endpoint checks
- pytest for comprehensive test suites with complex logic, data setup, and teardown
Start with Postman to explore and understand the API, then transition critical tests to pytest for long-term maintainability.
2.4 Running Tests in CI
# Run all API tests
API_BASE_URL=https://api.staging.example.com pytest tests/api/ -v \
--junitxml=results.xml
# Run only smoke tests
API_BASE_URL=https://api.staging.example.com pytest tests/api/ -m smoke -v
# Run with parallel execution (requires pytest-xdist)
API_BASE_URL=https://api.staging.example.com pytest tests/api/ -n 4 -v
# Run against production (read-only tests only)
API_BASE_URL=https://api.example.com pytest tests/api/ -m "readonly" -v