Recall & Review
beginner
What is Test-driven development (TDD)?
TDD is a software development process where you write tests before writing the actual code. You first write a failing test, then write code to pass the test, and finally refactor the code.
Click to reveal answer
beginner
What are the three main steps in the TDD cycle?
The three steps are: 1) Write a failing test (Red), 2) Write code to pass the test (Green), 3) Refactor the code to improve it (Refactor).
Click to reveal answer
beginner
Why do we write tests before code in TDD?
Writing tests first helps clarify what the code should do, ensures the code meets requirements, and prevents writing unnecessary code.
Click to reveal answer
beginner
What does it mean when a test is 'failing' in TDD?
A failing test means the code does not yet do what the test expects. This is the starting point in TDD to guide writing new code.
Click to reveal answer
intermediate
How does TDD help improve software quality?
TDD ensures code is tested continuously, catches bugs early, and encourages simple, clear code design.
Click to reveal answer
What is the first step in Test-driven development?
✗ Incorrect
In TDD, you always start by writing a test that fails because the code does not exist yet.
What does the 'Green' step in TDD mean?
✗ Incorrect
The 'Green' step means writing just enough code to make the failing test pass.
Why is refactoring important in TDD?
✗ Incorrect
Refactoring cleans and improves code structure while keeping the tests passing.
Which of these is NOT a benefit of TDD?
✗ Incorrect
TDD encourages simple design, not increased complexity.
In TDD, what should you do if a test passes without writing new code?
✗ Incorrect
If a test passes without new code, write a new failing test to continue the cycle.
Explain the Test-driven development (TDD) cycle and why each step is important.
Think about the Red-Green-Refactor steps.
You got /4 concepts.
Describe how TDD can improve software quality and developer confidence.
Consider how testing first affects the whole development process.
You got /4 concepts.