Quiz 2

🔁 TDD & Mutation Testing

157 words
1 min read
Python Week 1: the first filter for runtime behavior
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=Killed mutantsTotal mutantsEquivalent mutants\text{Score} = \frac{\text{Killed mutants}}{\text{Total mutants} - \text{Equivalent 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
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.