Legacy code (प्रायः परीक्षण गरिएको छैन, परिवर्तन गर्न गाह्रो कोड) परीक्षण गर्न चुनौतीपूर्ण हुन्छ — यसमा जटिल dependencies र कुनै परीक्षण नहुन सक्छ। सुरक्षित रूपमा परीक्षण थप्ने कार्यमा characterization tests, seams (dependencies तोड्नको लागि), र वृद्धिशील सुधार समावेश हुन्छ, जसले सुरक्षित परिवर्तन सक्षम गर्छ।
Legacy code को चुनौती
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.
