问题
What book would you recommend to learn test driven development? Preferrably language agnostic.
回答1:
- Test Driven Development By Example
- Refactoring: Improving the Design of Existing Code
- Extreme Programming: Embrace The Change
回答2:
Growing Object-Oriented Software, Guided by Tests by Addison-Wesley - it is about mocking frameworks - JMock and Hamcrest in particular.
From description of the book:
Steve Freeman and Nat Pryce describe the processes they use, the design principles they strive to achieve, and some of the tools that help them get the job done. Through an extended worked example, you’ll learn how TDD works at multiple levels, using tests to drive the features and the object-oriented structure of the code, and using Mock Objects to discover and then describe relationships between objects. Along the way, the book systematically addresses challenges that development teams encounter with TDD--from integrating TDD into your processes to testing your most difficult features.
EDIT: I'm now reading Working Effectively with Legacy Code by Michael Feathers which is pretty good. From the description of the book:
- Understanding the mechanics of software change: adding features,
fixing bugs, improving design, optimizing performance- Getting legacy code into a test harness
- Writing tests that protect you against introducing new problems
- This book also includes a catalog of twenty-four dependency-breaking techniques that help you work with program elements in isolation and make safer changes.
I read it already, it is one of the best programming books I've ever read (I personally think that it must be called Refactoring to Testability - it describes the processes for making your code testable). Because a testable code is good code.
回答3:
For me, this is the best one:
- Test Driven Development: By Example by Kent Beck
回答4:
Fairly recent reasonably written book The Art of Unit Testing. I am surprised it wasn't mentioned here.
回答5:
The Astels book is a solid introduction, Beck's book is good on the underlying concepts, Lasse Koskela has a newish one (Test Driven: TDD and Acceptance TDD for Java Developers). Osherove's book, as he says, is about Unit Testing, rather than TDD. I'm not sure that the Pragmatics' TDD book has aged as well as their original book.
Most everything is Java or C#, but you should be able to figure it out yourself.
回答6:
I'm a big fan of almost anything from the Pragmatic Bookshelf, but these two really helped drive the point home for me:
The Pragmatic Programmer: From Journeyman to Master. This ages really well. I'd recommend it to any developer.
Pragmatic Unit Testing in C# with NUnit, 2nd Edition. Don't let the title scare you. The concepts are pretty language agnostic, even with the C# examples.
回答7:
Dave Astels' Test-Driven Development: A Practical Guide
来源:https://stackoverflow.com/questions/797026/test-driven-development-book