- UID
- 177306
- 热情
- 0
- 人气
- 2
- 主题
- 0
- 帖子
- 150
- 精华
- 0
- 积分
- 78
- 分享
- 0
- 记录
- 0
- 相册
- 0
- 好友
- 0
- 日志
- 0
- 在线时间
- 177 小时
- 注册时间
- 2009-3-21
- 阅读权限
- 20
- 最后登录
- 2016-8-24

升级   68.57% - UID
- 177306
- 热情
- 0
- 人气
- 2
- 主题
- 0
- 帖子
- 150
- 精华
- 0
- 积分
- 78
- 阅读权限
- 20
- 注册时间
- 2009-3-21
|
原帖由 newmike 于 2009-7-26 15:31 发表 
4) 但是TDD建议的考虑顺序是不同的:" i9 M; ?4 G% s& P
i. what need to do (functionality)
ii. how to ensure the implementation is correct (test case): l$ ~- w* {5 m+ E" ~: Z Y. t( O
iii. how to implement it (implementation)- L( W }) A7 M- x
我想说的是,第2步,并不光是注重test本身,从test的角度发现object的user case,从而更好的设计你的code.而test case只是用来保证正确性的.
比方说,你的object是一个简单的calculator,你在想test的时候,先要想得是你要测试object的哪些functionality,比方说add,sub,mul,div, etc.,这样的话,从用户的角度来设计的你class,在完成这一步的时候,才会考虑正确性 -- 每一个的functionality的正确性 |
|