軟體開發的過程中,常常會存在著軟體錯誤(bug),而影響軟體的功能運作。本論文根據開發開放原始碼專案─SyncFree:一個使用Java技術開發之開放原始碼個人資料同步軟體 的經驗為基礎,加以系統化地歸納後,提出一個測試驅動的軟體除錯方法。 測試驅動的軟體除錯方法是使用JUnit Framework當作測試的驅動工具(Driver),藉由分析使用者回報的軟體錯誤報告與軟體開發流程所產出的UML文件圖表,進而分析設計出四種層級的單元測試(Functional Unit Test、Integration Unit Test、Logic Unit Test、Characterization Unit Test),來重新產生被回報的軟體錯誤。接著依據執行測試的結果,來逐步地縮小測試範圍,直到定位到軟體錯誤發生的所在程式碼位置;再根據軟體錯誤發生的狀況,對軟體錯誤進行修正。最後重複執行測試,一直到所有的測試都通過為止。 經由實行本方法,提供了原始程式開發者或承接專案的非原始程式開發者一個系統化的準則,來進行除錯。除此之外,本方法還有其他的附加價值。例如,非原始程式開發者在承接專案後,可以盡快地熟悉所承接的程式碼內容;在修復軟體錯誤的過程中,將會使該專案的測試案例越趨向完整與完善等。
Debugging is a common task performed during software development. In this thesis, debugging experiences accumulated in the development of SyncFree -- an open-source personal data synchronization tool implemented with Java -- are systematically organized into a test-driven method for debugging. Given a bug report and the UML artifacts generated during software development, the proposed method attempts to capture the bug in the form of a test. In so doing, the capturing tests are organized into a hierarchy of increasingly fine-grained tests, including functional unit tests (FUT), integration unit tests (IUT), logic unit tests (LUT), and characterization unit tests (CUT). Granularity of a test reflects the degree of exactness in the location to the bug. Test-driven debugging has the advantages of making the test suites more complete as each bug is fixed.