2025年测试驱动开发(TTD)

测试驱动开发(TTD)测试应用有很多方法 例如 黑盒测试 白盒测试 迭代测试 等 然而 这些方法都是从宏观上描述测试 的 为了在技术上保障测试的效果 Kent Beck 也是极限编程创始人 提出了在结果上进行限制的测试方法 也就是在编写程序之前 先确定程序中的变量 控件等元素允许的值

大家好,我是讯享网,很高兴认识大家。

        测试应用有很多方法,例如,黑盒测试、白盒测试、迭代测试等,然而,这些方法都是从宏观上描述测试的。为了在技术上保障测试的效果,Kent Beck(也是极限编程创始人)提出了在结果上进行限制的测试方法,也就是在编写程序之前,先确定程序中的变量、控件等元素允许的值。如果在编写程序时,变量、控件中的值与事先确定的值不相符,就说明程序的某处有bug,这种测试方法就是TDD(Test Driver Development,测试驱动开发)。TDD和Opengl ES一样,并不是具体的软件或程序库,只是一套测试框架(Junit),可用于对Android应用程序进行TDD测试。

Android SDK提供的测试框架,该测试框架基于Junit。测试框架不仅可以测试普通的java类(继承AndroidTestcase),也可以测试Android的应用程序组建,如Activity(ActivityInstrumentationTestCase2<>)、ContentProvider(ProviderTestCase<>)、和Service(ServiceTestCase<>)


讯享网

The testing framework has these key features:

  1. Android test suites are based on JUnit. You can use plain JUnit to test a class that doesn't call the Android API, or Android's JUnit extensions to test Android components. If you're new to Android testing, you can start with general-purpose test case classes such as AndroidTestCase and then go on to use more sophisticated classes.                                                                                          
  2. The Android JUnit extensions provide component-specific test case classes. These classes provide helper methods for creating mock objects and methods that help you control the lifecycle of a component.          
  3. Test suites are contained in test packages that are similar to main application packages, so you don't need to learn a new set of tools or techniques for designing and building tests.                            
  4. The SDK tools for building and tests are available in Eclipse with ADT, and also in command-line form for use with other IDEs. These tools get information from the project of the application under test and use this information to automatically create the build files, manifest file, and directory structure for the test package.                                                                                             
  5. The SDK also provides monkeyrunner, an API for testing devices with Python programs, and UI/Application Exerciser Monkey, a command-line tool for stress-testing UIs by sending pseudo-random events to a device.


Android测试框架结构图
小讯
上一篇 2025-02-05 14:23
下一篇 2025-01-24 12:46

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/13704.html