Legacy კოდი (ხშირად არატესტირებული, ცვლილებისთვის რთული კოდი) გამოწვევა წარმოადგენს ტესტირებისთვის — შეიძლება ჰქონდეს დაბნეული dependencies და არ აქვს ტესტები. ტესტების უსაფრთხოდ დამატება მოიცავს ტექნიკებს, როგორიცაა characterization ტესტები, seams dependencies-ების გასაწყვეტად, და ნაზი გაუმჯობესება, რაც უფრთხესი ცვლილებების საშუალებას იძლევა.
Legacy კოდის გამოწვევა
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.
