🔁 TDD & Mutation Testing
157 words
1 min read
Visual companion
Python
Type and operator map
Python Week 1: the first filter for runtime behavior
View
Revision summary
What this note is really saying
Short form
# 🔁 TDD & Mutation Testing ## 1. 🎯 Learning Objectives - Apply the Red-Green-Refactor cycle of TDD - Explain mutation testing and mutation score - Identify when TDD is appropriate ## 2.

🔁 TDD & Mutation Testing
1. 🎯 Learning Objectives
- Apply the Red-Green-Refactor cycle of TDD
- Explain mutation testing and mutation score
- Identify when TDD is appropriate
2. 📖 Core Content
3.1 TDD Cycle
(Diagram)
Benefits: Test coverage, clean design, regression safety.
3.2 Mutation Testing
Introduce small faults (mutations) into the program. If tests detect the mutation (test fails), the mutant is "killed." If tests pass, the mutant "survived" — indicating weak tests.
Mutation Score: Score=Total mutants−Equivalent mutantsKilled mutants
Example mutations:
- Change > to >=
- Change + to -
- Remove a statement
- Swap true/false
4. 📝 Practice Questions
Q1: In TDD, when do you write the production code?Answer: After writing the failing test (RED phase) and before refactoring (GREEN phase). The test must fail first to prove it can detect the bug. Join Discord PreviousWhite-Box TestingNextTest Automation