public abstract class

ActivityInstrumentationTestCase2

extends ActivityTestCase//继承自ActivityTestCase类

This class provides functional testing of a single activity. The activity under test will be created using the system infrastructure (by calling InstrumentationTestCase.launchActivity()) and you will then be able to manipulate your Activity directly.

-----------------------------------------------------------------------------------------------------------------------------------

该类提供单独的activity的功能测试.在测试项目下的该activity能够使用系统基类(调用: InstrumentationTestCase.launchActivity())并且你能够直接操作你自己的Activity的。

  • You can run any test method on the UI thread (see UiThreadTest).//你能够在UI thread上跑任何的测试方法
  • You can inject custom Intents into your Activity (see setActivityIntent(Intent)).//你能够在你的Activity注入自定义的Intents(该描述意味着允许跳转)

This class replaces ActivityInstrumentationTestCase, which is deprecated. New tests should be written using this base class.//该类替代ActivityInstrumentationTestCase, 该类现在不建议使用。新的测试集应该使用该基础类。

If you prefer an isolated unit test, see ActivityUnitTestCase.//如果你更喜欢一个独立的单元测试,请参见ActivityUnitTestCase

------------------------------------------------------------------------------------------------------------------------------------

Summary:

Public Constructors:

ActivityInstrumentationTestCase2(String pkg, Class<T> activityClass)

//This constructor was deprecated in API level 8. use ActivityInstrumentationTestCase2(Class) instead(在高于API level 8后,该构造方法被下方的方法取代了)

 
ActivityInstrumentationTestCase2(Class<T> activityClass)
//Creates an ActivityInstrumentationTestCase2.
---------------------------------------------------------------------------------------------------------------------------------------
Public Methods:
T getActivity()

Get the Activity under test, starting it if necessary.//获取在测试下的Activity,如果必要的话可以启动
void setActivityInitialTouchMode(boolean initialTouchMode)

Call this method before the first call to getActivity() to set the initial touch mode for the Activity under test.//在第一次调用 getActivity()方法前可以调用该方法去初始化测试下Activity的TOUCH模式
void setActivityIntent(Intent i)

Call this method before the first call to getActivity() to inject a customized Intent into the Activity under test.//在第一次调用 getActivity()方法前可以调用该方法去注入测试下Activity的自定义的INTENT
 
 
 
Protected Methods
void runTest()

Runs the current unit test.
void setUp()

Sets up the fixture, for example, open a network connection.
void tearDown()

Make sure all resources are cleaned up and garbage collected before moving on to the next test.
 

Intrumentation类:ActivityInstrumentationTestCase2学习(1)的更多相关文章

  1. php大力力 [019节]php分页类的学习

    2015-08-26 php大力力019.php分页类的学习 [2014]兄弟连高洛峰 PHP教程14.2.1 分页需求分析 14:18 [2014]兄弟连高洛峰 PHP教程14.2.2 分页类中分页 ...

  2. 20175212童皓桢 在IDEA中以TDD的方式对String类和Arrays类进行学习

    20175212童皓桢 在IDEA中以TDD的方式对String类和Arrays类进行学习 要求 在IDEA中以TDD的方式对String类和Arrays类进行学习 测试相关方法的正常,错误和边界情况 ...

  3. Exception类的学习与继承总结

    日期:2018.11.11 星期日 博客期:023 Exception类的学习与继承总结 说起来我们上课还是说过的!老师提到了报错问题出现主要分Exception和Error两类!第一次遇见这个问题是 ...

  4. 20155312张竞予 20170510实践一:在IDEA中以TDD的方式对String类和Arrays类进行学习

    实践题目 在IDEA中以TDD的方式对String类和Arrays类进行学习 测试相关方法的正常,错误和边界情况 String类 charAt split Arrays类 sort binarySea ...

  5. 20155326 第12周课堂实践总结(二)String类和Arrays类的学习

    20155326 第12周课堂实践总结(二)String类和Arrays类的学习 实践二 Arrays和String单元测试 实践题目 在IDEA中以TDD的方式对String类和Arrays类进行学 ...

  6. 06.FileStream类的学习

    //FileStream类是用来操作字节的,也就是可以操作所有文件. 因为所有的文件都是以字节形式来存储的. //StreamReader类和StreamWriter类是用来操作字符的. FileSt ...

  7. 05.File类的学习

    File  是文件的意思 File类是一个静态类,所以File类是一个工具类 File类是专门操作文件的类 File的常用方法 namespace _16.File类的学习 { class Progr ...

  8. 04.Path类的学习

    path 是路径的意思. path类是一个静态类,所以path是一个工具类. Path类是专门用来操作路径的. Path的常用方法: namespace _15.Path类的学习 { class Pr ...

  9. getID3类的学习使用

    getID3类的学习使用 网上描述: getID3()这个PHP脚本能够从MP3或其它媒体文件中提取有用的信息如:ID3标签,bitrate,播放时间等. (格式包括:Ogg,WMA,WMV,ASF, ...

随机推荐

  1. DevOps教程

    唠叨话 关于德语关我屁事与靠计算逼哥数据,知识点的教学教程. 先简要搭建知识点框架:后逐步完善知识点内容.(暂时提供知识点,大部分未完善,持续更新中.) 注:第一版本,结束于2017年10月18日.其 ...

  2. windows中vim-airline研究笔记

    vim-airline网上的介绍与安装教程一大堆,我就不累述了 但是,在win下如何让airline插件正常显示箭头等特殊字符着实让我头疼了不少. 最初,我是用的monaco字体 但正如你所见,并没有 ...

  3. ThreadPoolExecutor系列<一、ThreadPoolExecutor 机制>

    本文系作者原创,转载请注明出处:http://www.cnblogs.com/further-further-further/p/7681529.html 解决问题: 1. 处理大量异步任务时能减少每 ...

  4. JPA + SpringData 操作数据库原来可以这么简单 ---- 深入了解 JPA - 3

    原创播客,如需转载请注明出处.原文地址:http://www.cnblogs.com/crawl/p/7718741.html ------------------------------------ ...

  5. 【NOIP2015提高组】Day2 T2 子串

    题目描述 有两个仅包含小写英文字母的字符串 A 和 B.现在要从字符串 A 中取出 k 个互不重叠的非空子串,然后把这 k 个子串按照其在字符串 A 中出现的顺序依次连接起来得到一 个新的字符串,请问 ...

  6. JavaScript OOP 之 this指向

    今天给大家分享一个JavaScript OOP中关于分辨this指向对象的小技巧,很实用呦! 我们先来看一段代码: 大家能判断出func();和obj.func();这两句的this指向吗? 首先,我 ...

  7. python去除读取文件中多余的空行

    今天在写登录程序练习的时候,黑名单文件中多了几行空行.导致运行的时候报错:IndexError: list index out of range 代码 brackData = open(brackDa ...

  8. spark的sparkUI如何解读?

    spark的sparkUI如何解读? 以spark2.1.4来做例子 Job - schedule mode 进入之后默认是进入spark job 页面 这个说明有很详细的解释,spark有两种操作算 ...

  9. 微信小程序之bindtap事件绑定传参

    wxml代码: <view class='fen'> <text bindtap='prev' data-page="{{pageDang}}">上一页&l ...

  10. setsockopt()和getsockopt()函数参数

    setsockopt()函数功能介绍 功能描述: 获取或者设置与某个套接字关联的选项.选项可能存在于多层协议中,它们总会出现在最上面的套接字层.当操作套接字选项时,选项位于的层和选项的名称必须给出.为 ...