Recall & Review
beginner
What is the first step in the Test-driven development (TDD) workflow?
Write a failing test that defines a new function or improvement before writing the actual code.
Click to reveal answer
beginner
Why do you write a failing test first in TDD?
To clearly define what the code should do and ensure the test fails because the feature is not implemented yet.
Click to reveal answer
beginner
What comes after writing a failing test in the TDD cycle?
Write the minimum amount of code needed to make the test pass.
Click to reveal answer
intermediate
What is the purpose of the 'refactor' step in the TDD workflow?
To clean up and improve the code without changing its behavior, ensuring it remains simple and maintainable.
Click to reveal answer
intermediate
In TDD, what should you do if a test fails after refactoring?
Fix the code so the test passes again, ensuring the refactoring did not break functionality.
Click to reveal answer
What does the 'Red' phase in TDD mean?
✗ Incorrect
The 'Red' phase means writing a test that fails because the feature is not implemented yet.
Which step follows after making a failing test pass in TDD?
✗ Incorrect
After making the test pass, you refactor the code to improve its structure.
Why is TDD considered helpful?
✗ Incorrect
TDD helps catch bugs early and encourages better code design by writing tests first.
What should a test do in TDD before you write the code?
✗ Incorrect
Tests should fail initially to confirm they are valid and the feature is not yet implemented.
In TDD, what is the main goal of the 'Refactor' step?
✗ Incorrect
Refactoring improves code structure and readability without changing what the code does.
Describe the three main steps of the Test-driven development workflow and why each is important.
Think of TDD as Red-Green-Refactor cycle.
You got /4 concepts.
Explain how Test-driven development helps improve software quality and developer confidence.
Focus on benefits of writing tests before code.
You got /4 concepts.