敏捷开发--TDD

TDD (Test Driven Development):顾名思义测试驱动开发,在没有开发之前,先写test case, 写出来的code要满足test case.

Test Driven Development is the strategy of writing tests along the
development process. These test cases are written in advance of the code that is
supposed to satisfy them.
A single test is added, then the code needed to satisfy the compilation of this test and
finally the full set of test cases is run to verify their results.

TDD的流程:

1. 写test cases, 实际上写test case的过程就是理解需求的过程, 写test case的过程中会驱使我们去想清楚如何去开发, 使我们能使提前想到一些可能会出现的问题.

2.run test cases: 为了能让所有的test cases run成功, 不断的完善开发代码

3. 重构代码: 当所有的test case pass, 重构代码,清理没有用的,是代码更加干净紧凑; 重构完成没有可以再优化的地方,而且所有的test cases pass的时候,任务就完成啦

 

这个跟完全颠覆了我们先开发再测试的观点, 这样做有什么好处捏?

1. 让开发过程变成已结果为主导, 让需求更明确, 不会开发出没有用的代码

2. 当要对代码做出改变时,会很清楚的知道会影响系统的那些部分

 

对于TDD的实用性不敢妄加评论,也没有在实际项目中用到这种模式。这种模式成熟型的公司有可能会用到, 创业型的公司应该不会使用,因为代码量差不多多了一倍,风险也因此增加。希望以后可以在个小的项目中应用,感受一下他的魅力.

 

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值