All you need to know about the pyramid of tests
⚡️All you need to know about the pyramid of tests:
When it comes to software testing, it's crucial to remember:
✅ Tests are independent. One should NEVER influence another.
✅ NEVER test technical details or privates. Focus on functionality.
✅ "stubbing" is our friend, "mocking" might not always be. Know your test-doubles and the reasons behind each choice!
3 categories, names are well known but each one has his own definition 😅.
Personally,I believe on those:
🤖 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 stubs for dependencies & is framework independent.
- Ensures functional non-regression.
🔗 Integration Tests:
- Checks if dependencies work as intended.
- Essentially, tests what we've stubbed during unit testing.
🌐 E2E Tests:
- Cross-layer test ensuring user-centric behavior.
- No mocks, stubs, or fakes. Purely system tests.
- Tread lightly! They're fragile & can break easily.
- As UI details can shift, snapshot testing can help spot accidental regressions. Maybe best adapted for UI
💡same names but rarely same definitions.
I learned to always develop, reformulate and give example when talking with a programmer ☺️