How to test efficiently
⚡️How to test efficiently :
✅ Tests should be always independent. One should NEVER influence another.
✅ Focus on functionality not functions. NEVER test technical details or privates.
✅ Follow Dependency inversion principal. Keep your components pure so you can configure differently to ease testing them.
✅ Know your test-doubles and the reasons behind each choice!
There is 3 categories of tests. names are well known but each one has his own definition 😅
🤖 Unit Tests:
- Validates functional specifications.
- Captures behaviors, NOT technical details.
- Enables Algorithm discovery.
- Gives immediate feedback for both old & new features.
- Super fast! (~1 second).
- Uses test doubles and never real adapters.
🔗 Integration Tests:
- Checks if dependencies work as intended.(real adapters)
- Essentially, tests what we've doubled during unit testing.
🌐 E2E Tests:
- Cross-layer test ensuring user-centric behavior.
- Uses the real configuration. No mocks, stubs, or fakes. Purely system tests.
- They're fragile & can break easily.
💡Your dev team uses probably the same names but rarely same definitions.