Semaine 3 : Untestable code Flashcards
1
Q
Why should I write tests?
A
- Manual testing is too expensive
- It is too easy to make mistakes
- How can I make sure my new code doesn’t break the existing one?
- It’s the right thing to do
2
Q
What is a test?
A
In other words, a test is just a piece of code that invokes a method and tests its output.
3
Q
Qu’est-ce que le SRP?
A
Le single responsibility principle est qu’une classe doit avoir une seule responsabilité. S’il y’en a plus qu’une, il faut refactor.
4
Q
Quel est le principe de reduce coupling?
A
- Group dependencies
- Define better interfaces
- Rely on mock objects