Kodi i vjetër (shpesh i pa testuar, kod i vështirë për t'u ndryshuar) është sfiduese për testim — mund të ketë varësi të ndërlikuara dhe asnjë test. Shtimi i testeve me siguri përfshin teknika si testet e karakterizimit, lidhjet për thyerjen e varësive, dhe përmirësimi progresiv, duke mundësuar ndryshime më të sigurta.
Sfida e kodit të vjetër
Legacy code is often: untested, tightly coupled, hard to understand, risky to change:
→ no tests → changing it is dangerous (you can't tell if you broke something)
→ hard to test → dependencies are tangled (can't isolate units); not designed for testing
→ a chicken-and-egg problem: to change safely you need tests, but it's hard to test.
