Test Driven Development for Embedded C (Paperback)

James W. Grenning



Did you write C code last week? Does your code work? Is your design clean? If you answered yes to the first question but got queasy over the second two, you need to know about Test Driven Development. TDD helps you write code that works the first time, and then helps you keep it running as the code evolves to meet new needs.

In Test Driven Development for Embedded C, author James W. Grenning shows embedded software developers how to bring the benefits of TDD to embedded C.

In the book, you'll see how to apply TDD to C and the world of embedded software development. Learn how to break key dependencies, allowing code to be tested thoroughly. Explore how to test-drive your product's core logic, exploiting the power of your development environment to deliver better software.

In fact, as the book shows, you can test-drive a device driver before you even have the device soldered into a circuit board. Avoid the natural delays when testing on the target by using the tailored TDD Microcycle, employing off-target tests and dual-targeted code.

Learn how to make code testable and more flexible, better able to handle the inevitable changes demanded by the market. The tests drive development and then serve as an executable specification, keeping track of the critical details and assumptions baked into the code.

In Test Driven Development for Embedded C, you'll find that TDD is a different way to program-unit tests are written in a tight feedback loop with the production code, producing testable code and greatly reducing wasteful debugging. TDD also influences design. When tests are considered part of design, you create modular and loosely coupled code, the hallmarks of a good design.

With Test Driven Development for Embedded C, C developers-even embedded C developers-can finally write cleaner, testable code with TDD.


你上週寫了 C 語言的程式碼嗎?你的程式碼運作正常嗎?你的設計乾淨嗎?如果你對第二和第三個問題感到不安,那麼你需要了解測試驅動開發(Test Driven Development,TDD)。TDD 可以幫助你寫出第一次就能運作的程式碼,並在程式碼不斷演進以滿足新需求時保持其運作。

在《Test Driven Development for Embedded C》一書中,作者 James W. Grenning 展示了如何將 TDD 的好處應用於嵌入式 C 語言開發。在這本書中,你將學習如何將 TDD 應用於 C 語言和嵌入式軟體開發領域。了解如何打破關鍵依賴,使程式碼能夠進行全面測試。探索如何以測試驅動的方式開發產品的核心邏輯,充分利用開發環境的優勢,提供更好的軟體。

事實上,正如本書所示,你甚至可以在將裝置焊接到電路板之前就對裝置驅動程式進行測試驅動開發。通過使用定制的 TDD 微循環,利用離線測試和雙目標代碼,避免在目標上進行測試時自然產生的延遲。


在《Test Driven Development for Embedded C》一書中,你會發現 TDD 是一種不同的程式設計方式-單元測試與產品程式碼在緊密的反饋迴圈中編寫,產生可測試的程式碼,大大減少了冗長的除錯過程。TDD 也會影響設計。當測試被視為設計的一部分時,你將創建模組化且鬆散耦合的程式碼,這是良好設計的特點。

有了《Test Driven Development for Embedded C》,C 語言開發者-甚至嵌入式 C 語言開發者-終於可以使用 TDD 撰寫更乾淨、可測試的程式碼了。