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. 部署LAMP+NFS实现双Web服务器负载均衡

    一.需求分析 1.前端需支持更大的访问量,单台Web服务器已无法满足需求了,则需扩容Web服务器: 2.虽然动态内容可交由后端的PHP服务器执行,但静态页面还需要Web服务器自己解析,那是否意味着多台 ...

  2. 验证代理IP

    ##author:wuhao#import urllib.requestfrom http import cookiejar import xlrd import threading #有效的代理,可 ...

  3. php设计模式 工厂模式和单例模式

    一.单例模式//让该类在外界无法造对象//让外界可以造一个对象,做一个静态方法返回对象//在类里面通过让静态变量控制返回对象只能是一个. 单例模式的要点有三个: 一是某个类只能有一个实例: 二是它必须 ...

  4. spring容器启动扩展

    我们可以在spring容器启动时添加自己的定制化初始化工作. 1)具体方法为:在web.xml中配置初始化属性contextInitializerClasses的值例如: <context-pa ...

  5. ModelForm

    这是一个神奇的组件,通过名字我们可以看出来,这个组件的功能就是把model和form组合起来,对,你没猜错,相信自己的英语水平. 先来一个简单的例子来看一下这个东西怎么用: 比如我们的数据库中有这样一 ...

  6. keepalived实现nginx高可用

    keepalived是什么 keepalived直译就是保持存活,在网络里面就是保持在线了,也就是所谓的高可用或热备,用来防止单点故障(单点故障是指一旦某一点出现故障就会导致整个系统架构的不可用)的发 ...

  7. Servlet 笔记-Session 跟踪

    HTTP 是一种"无状态"协议,这意味着每次客户端检索网页时,客户端打开一个单独的连接到 Web 服务器,服务器会自动不保留之前客户端请求的任何记录. 但是仍然有以下三种方式来维持 ...

  8. Servlet 笔记-过滤器

    Servlet 过滤器可以动态地拦截请求和响应,以变换或使用包含在请求或响应中的信息. 可以将一个或多个 Servlet 过滤器附加到一个 Servlet 或一组 Servlet.Servlet 过滤 ...

  9. jQrid常用操作(转帖)

    转自: http://blog.csdn.net/zhcj3672/article/details/6944955 JqGrid相关操作备忘 方法列表 1.获得当前列表行数: $("#gri ...

  10. TinyOS编程思想和Nesc基础语法

    TinyOS操作系统由nesc语言写成,从程序员角度看,它的基本作用就是提供了一组API接口以及一些编程规则. 具体来说,基于nesc语言的TinyOS编程行为具有以下特点: a.兼容C语言:使用ne ...