Glossary CRAP
CRAP
Acronym Also known as:
crap score, crap metric, change risk anti-patternsTechTesting
Definition
Change Risk Anti-Patterns — Alberto Savoia's metric combining a method's cyclomatic complexity with how little of it the tests cover; high complexity with low coverage is the code most likely to break when changed
A metric, not a kind of testing. CRAP(m) = comp(m)² × (1 − cov(m)/100)³ + comp(m); the conventional threshold is 30. It points at the method to test next, which coverage alone cannot.
The number that says "this one." Coverage across a codebase is a mood; CRAP names the method that is both hard to understand and untested, which is where the next regression lives.
Avoid: "CRAP testing." There is no such practice; the score ranks code for the testing you were going to do anyway.