欢迎来到天天文库
浏览记录
ID:42561810
大小:25.94 KB
页数:5页
时间:2019-09-17
《android_test包》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、androidtest包下的其他测试类简单解释一下android.test包下的其他测试类,给大家一个了解。 Java代码 1.[b]Interfaces[/b] 2.PerformanceTestCase 3.PerformanceTestCase.Intermediates 4.TestSuiteProvider 5.[b]Classes[/b] 6.ActivityInstrumentationTestCase 7.ActivityInstrumentationTestCase2 8.ActivityTestCase 9.
2、ActivityUnitTestCase 10.AndroidTestCase 11.AndroidTestRunner 12.ApplicationTestCase 13.InstrumentationTestCase 14.InstrumentationTestRunner 15.InstrumentationTestSuite 16.IsolatedContext 17.LoaderTestCase 18.MoreAsserts 19.ProviderTestCase 20.ProviderTestCase2 21.
3、RenamingDelegatingContext 22.ServiceTestCase 23.SingleLaunchActivityTestCase 24.SyncBaseInstrumentation 25.TouchUtils 26.ViewAsserts 以上列出的是android.test包下的所有接口以及类,那么简单了解一下,起码能够不盲目崇拜框架,市场上的大多数框架都是基于android.test包来实现的,如果你发现没有针对于它们来实现的,那么有可能就是有root权限的手机,或者操作系统是自己的手机反射来进行测试的,
4、不过我也不能绝对这么说,如果有其他好玩的框架,欢迎留言,我也去研究研究,谢谢。 Interface接口 接口部分包含3个接口PerformanceTestCase、PerformanceTestCase.Intermediates、TestSuiteProvider。 PerformanceTestCase性能测试接口,也是当前某些测试开发工程师或者开发熟知的这么一个性能测试手段,需要进行性能测试的类需要实现这个接口,采用白盒代码注入的方式获取当前类的性能,这种方式不能讲测试与开发代码进行很好的分离,当前使用范围不大。不过推荐开发同学使用这种方式
5、自测。 PerformanceTestCase.Intermediates接口,是实现PerformanceTestCase类的回调方法,用于收集相关的数据。使用方式:startPerformance(PerformanceTestCase.Intermediatesintermediates),实现PerformanceTestCase的类可以直接调用startPerformance方法。 TestSuiteProvider这个接口一般都不会直接使用,子类InstrumentationTestRunner比它好用,这个接口就是获取一下tests
6、uite。 classes相关类 ActivityInstrumentationTestCase,这是一个废弃功能测试类,在API3之前的才可以使用,也就是android操作系统1.5版本,对当前的测试开发工程师来说,恩恩,忽略它吧。 ActivityInstrumentationTestCase2,这个是当前主流用于测试apps功能的测试类,大名鼎鼎的robotium就是基于这个类来实现的,当前这个类的底层也用时instrmentation去玩android的,这个类直接使用系统底层资源来做测试,运行在ui线程中,意思就是,你使用这个类进行测试
7、,肯定是需要将apps运行起来的,能看见界面的。他的父类是android.test.ActivityTestCase,爷爷是android.test.InstrumentationTestCase,你看这个拼爹的时代,有个好爹,这个类就非常好用了。 ActivityTestCase,这个类其实我个人认为没有存在的必要,作为一个父亲没有做到父亲的职责,就是让集成它的儿子们属性看起来明显一点,恩,看你们集成ActivityTestCase肯定是测试Activity的,好吧,不推荐大家去使用了,它就是对爷爷instrumentationtestcase
8、的集成,好用的功能都在instrumentationtestcase里呢,对于父亲来讲,这一代家道中落。 ActivityUnitTes
此文档下载收益归作者所有