Intermediate LevelSoftware Engineering Principles
What is Mutation Testing (Stryker) and how does it measure test suite effectiveness?
❓ Interview Prompt: Explain Mutation Testing (Stryker Mutator), mutating operators (`+` to `-`, `>` to `<`), Killed vs Survived mutants, and code coverage flaws.
Standard Code Coverage (100% line coverage) can be misleading because code can be executed without verifying assertions!
How Mutation Testing Works (Stryker):
1
Mutates source code by injecting small intentional bugs (Mutants): changing '>' to '<', '+' to '-', or deleting function calls.
2
Runs existing test suite against each Mutant.
3
If tests Fail $\rightarrow$ Mutant is Killed (Good!). If tests Pass $\rightarrow$ Mutant Survived (Weak assertions!).
Code Implementation Example
bash
# Execute Stryker Mutation Testing CLI for JavaScript/TypeScript:
npx stryker run💡Executing Stryker Mutation Testing CLI to evaluate test assertion quality.
🎯 Interview Key Takeaway
Use Mutation Testing to evaluate the actual assertion strength of your test suite beyond simple line coverage percentages.
#Mutation Testing#Stryker#Test Quality#Intermediate
Back to all Software Engineering Principles Questions→