测试驱动开发(TTD)
测试应用有很多方法,例如,黑盒测试、白盒测试、迭代测试等,然而,这些方法都是从宏观上描述测试的。为了在技术上保障测试的效果,Kent Beck(也是极限编程创始人)提出了在结果上进行限制的测试方法,也就是在编写程序之前,先确定程序中的变量、控件等元素允许的值。如果在编写程序时,变量、控件中的值与事先确定的值不相符,就说明程序的某处有bug,这种测试方法就是TDD(Test ,测试驱动开发)。TDD和 ES一样,并不是具体的软件或程序库,只是一套测试框架(Junit),可用于对应用程序进行TDD测试。
SDK提供的测试框架,该测试框架基于Junit。测试框架不仅可以测试普通的java类(继承),也可以测试的应用程序组建,如()、()、和()。
The has these key :
test are based on JUnit。 You can use plain JUnit to test a class that doesn't call the API, or 's JUnit to test 。 If you're new to , you can start with - test case such as then go on to use more 。 The JUnit - test case 。 These for mock and that help you the of a 。
Test are in test that are to main , so you don't need to learn a new set of tools or for and tests。 The SDK tools for and tests are in with ADT, and also in -line form for use with other IDEs。 These tools get from the of the under test and use this to the build files, file, and for the test 。
The SDK also , an API for with , andUI/ , a -line tool for - UIs by - to a 。
测试框架结构图
----------------------------------------------- 真正对的那个人永远不会错过- ---------------------------------------------------
测试类书写指导
测试类型
继承的类
获取测试对象的代码
tion
= this.()
= ()
= new (,.class);
();
= ();
普通Java类
= new ();