レガシーコード(テストされていない、変更が難しいコード)のテストは課題です。テストされていない可能性があり、依存関係が複雑で、テストが存在しないかもしれません。テストを安全に追加するには、characterization テスト、依存関係を破るためのseams、段階的な改善などの技法を使用します。これにより、より安全に変更できるようになります。
レガシーコードの課題
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.
