Ensure tests are comprehensive and explicit to prevent regressions and gaps in coverage. Tests should cover all scenarios including edge cases, error conditions, and boundary conditions. Avoid vague assertions that could pass even when the implementation is incorrect.
Key practices:
Example of explicit vs vague testing:
# Vague - could pass even if no parameters are missing
assert len(missing_params) < max_allowed
# Explicit - tests exact expected behavior
assert len(missing_params) == 2
assert "required_field" in missing_params
assert "another_field" in missing_params
When adding new features or modifying behavior, always ask: “What scenarios could break this?” and “What edge cases am I not testing?” This prevents regressions and ensures robust, reliable code.
Enter the URL of a public GitHub repository