0
0
Testing Fundamentalstesting~5 mins

Test-driven development (TDD) concept in Testing Fundamentals - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AWrite a failing test
BWrite the full code
CRefactor the code
DRun the application
What does the 'Green' step in TDD mean?
ADelete old tests
BWrite a failing test
CRefactor the code
DWrite code to pass the test
Why is refactoring important in TDD?
ATo add new features
BTo improve code without changing behavior
CTo remove tests
DTo write documentation
Which of these is NOT a benefit of TDD?
AHelps catch bugs early
BEnsures code meets requirements
CIncreases code complexity
DEncourages simple design
In TDD, what should you do if a test passes without writing new code?
AWrite a new failing test
BRefactor the code
CDelete the test
DIgnore it
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.