开发者

Test-driven development vs. Test-first development

What is test开发者_Go百科-first development and how does it corelate to TDD? Is test-first development a general name for things like TDD? If yes, what other test-first practices do exist?


Test First Development is slightly broader, slightly less specific, than TDD. You can write an acceptance test before coding, then code to make it pass; that's TFD but not TDD. TDD is more specifically about unit tests - so there is a tighter implied granularity - and includes the red-green-refactor cycle: write your failing (unit) test; demonstrate that it fails; make it pass; demonstrate that it passes; look for opportunities to refactor. TFD doesn't preclude any of those things, but it also doesn't require them.


Test-First Development == Test-Driven Development.

Two different words for the same thing.

Other alternatives to TDD include the increasingly popular BDD (Behaviour Driven Development).

Which method you choose greatly depends both on your application (web, console, windows, etc) as well as your project methodology (Agile, Waterfall, etc).


TFD is a subclass of TDD.

TDD: You write a piece of code and you write test for it.

TFD: You write a test first writing minimal code to make it pass. Then think of the logic and build the code. With this way your code can be well formed and minimal.

TFD can be very helpful sometimes. Instead of jumping into the implementation and test it, you might want to test small pieces of it before writing the whole.

But the purpose of TFD and TDD both are the same.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜