開発
About Test Driven Development
will
What is Test Driven Development(TDD)?
It is a kind of software development process that relies on the repetition of a very short development cycle: Firstly, the developers write test cases that a desired improvement or new function(initially failing); Secondly, produces the minimum amount of code to pass these tests; Thirdly, re-factors the new code to acceptable standards. Or simply with Red-Green-Refactor. Red and green is original from built result of code. Red is failed and green is successfully to build the code.
In 1996 Ken Beck firstly used Extreme Programming(XP) in C3 project. XP encourages test first development. In the 2003, he published “Test-Driven Development by Example” to proposed test first development as Test Driven Development.
Why Test Driven Development is needed?
TDD create test cases before coding. By doing this, can verify the requirement and find defects earlier to reduce the cost caused by fixing defect/bug. It is said that with TDD, the bugs can have 40~90% fewer, compared with traditional development process.
What changes caused by TDD
There are some slogans of TDD can show the changes:
Keep it Simple, Stupid(KISS)
You Aren’t Going to Need It(YAGTNI)
Keep the unit small
Use pattern only it is needed.
Current status of TDD
In 2006, Dan North published “Introduce BDD” in Better Software magazine. From then, more developers talked about BDD. But Matt Wynne,author of Cucumber, described that:
BDD builds upon TDD by formalizing the good habits of the best TDD practitioners.
It is short, but difference is described clearly.
As a developer, I am more concerned with existing framework to support it:
For Objective-c:
Unit Testing:
OCUnit/SenTestingKit, GHUnit, and etc.
RSpec Style:
Kiwi, Cedar, and etc.
Acceptance Testing
UI Automation, Frank, KIF, and etc.