← Quiz: Unit Testing and TDD: all 10 questions
Quiz: Unit Testing and TDD · Question 9 of 10
Why is passing an SMS sender into a function as a parameter good for testing?
Why is passing an SMS sender into a function as a parameter good for testing?
- A.It makes the SMS faster
- B.The test can pass a mock, so no real SMS is sent and the calls can be checked
- C.It removes the need for asserts
- D.Parameters are always faster than globals
Answer & explanation
Correct answer: The test can pass a mock, so no real SMS is sent and the calls can be checked
This is dependency injection; it lets the unit be tested on its own.
Can you get the rest right without peeking?
Take the timed Quiz: Unit Testing and TDD quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →