← All topics
Quiz: Unit Testing and TDD: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. What are the three parts of a well-structured unit test?
- Q2. What does this print? (code)
- Q3. In TDD, what must happen in the "red" step?
- Q4. What does this print? (code)
- Q5. What is the difference between a stub and a mock?
- Q6. According to the test pyramid, which tests should a project have the MOST of?
- Q7. A function has 100% statement coverage. What can you conclude?
- Q8. A unit test passes on the developer's laptop but fails on the CI server at midnight because it uses today's date. Which FIRST property does…
- Q9. Why is passing an SMS sender into a function as a parameter good for testing?
- Q10. A change turns = into and an existing test for the exact boundary now fails. What kind of bug did the test catch?