我们知道,TDD意味着“先写测试,然后写代码”.而对于单元测试,这是很好的,因为你在“单位”内受到限制.
然而,当谈到UI时,预先编写功能测试对于我来说是不太有意义的.这是因为功能测试必须验证一个(可能很长的)功能要求.这可能通常跨越多个屏幕(页面),诸如“登录”,“最近插入记录”等先决条件.
Test-driven development is difficult to use in situations where full functional tests are required to determine success or failure. Examples of these are user interfaces,programs that work with databases,and some that depend on specific network configurations.
(当然,维基百科不是“权威”,但这听起来很合乎逻辑.)
尝试
BDD,Behavior Driven Development.它促进撰写规范故事,然后逐步执行,刺激应用程序更改其状态并验证结果.
原文链接:/javaschema/281870.html