0
0
Software Engineeringknowledge~5 mins

Test-driven development (TDD) in Software Engineering - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is Test-driven development (TDD)?
TDD is a software development approach where tests are written before writing the actual code. It helps ensure the code works as expected by guiding development through tests.
Click to reveal answer
beginner
What are the three main steps in the TDD cycle?
The three steps are: 1) Write a failing test, 2) Write code to pass the test, 3) Refactor the code to improve it while keeping tests passing.
Click to reveal answer
intermediate
Why is writing tests first beneficial in TDD?
Writing tests first helps clarify what the code should do, prevents overcoding, and ensures that every piece of code is tested from the start.
Click to reveal answer
intermediate
How does TDD improve software quality?
TDD improves quality by catching bugs early, encouraging simple design, and providing a safety net for future changes through automated tests.
Click to reveal answer
beginner
What is refactoring in the TDD process?
Refactoring means improving the code's structure and readability without changing its behavior, done after tests pass to keep code clean and maintainable.
Click to reveal answer
What is the first step in the TDD cycle?
ARefactor the code
BWrite the full code
CRun all tests
DWrite a failing test
Why do developers refactor code after writing tests in TDD?
ATo improve code without changing behavior
BTo add new features
CTo remove tests
DTo make tests fail
Which of the following is NOT a benefit of TDD?
AFaster initial coding without tests
BEarly bug detection
CClear requirements
DBetter code design
In TDD, what does a passing test indicate?
AThe test is incorrect
BThe code meets the test requirements
CThe code needs more features
DThe test should be deleted
How does TDD help with future code changes?
ABy removing old code
BBy delaying testing until the end
CBy providing automated tests as safety checks
DBy avoiding writing tests
Explain the Test-driven development (TDD) cycle and why each step is important.
Think about how tests guide coding and how refactoring keeps code clean.
You got /4 concepts.
    Describe the main benefits of using TDD in software development.
    Consider how tests help both during and after development.
    You got /4 concepts.