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. Interface request structure used for socket ioctl's

    1. 结构体定义 /* * Interface request structure used for socket * ioctl's. All interface ioctl's must have ...

  2. nodejs+mongoose操作mongodb副本集实例

    继上一篇设置mongodb副本集之后,开始使用nodejs访问mongodb副本集: 1:创建项目     express 项目名称 2:npm install mongoose    安装mongo ...

  3. win10 UWP 单元测试

    我们在写代码的时候不能保证我们写出来的代码是正确的,所以我们经常要单元测试. 单元测试和重构都是在做完一个小小函数一般就要进行一次,越早做就越好,可以比较早发现问题,这时我们还记得我们写的内容,不过比 ...

  4. zookeeper 笔记-ACL

    zookeeper中,znode的ACL是没有继承关系的,是独立控制的,zookeeper的acl可以从3个维度理解,一是scheme,二是user,三是permission,通常表示为scheme: ...

  5. 关于echarts、layer.js和jqGrid的知识点

    使用echarts和layer.js直接去官方文档,能解决大部分问题. 但是有些问题,解释不够清楚,在这里记录一下. 1.echarts的使用 第一点:关于echarts的labelline在数据为零 ...

  6. ASP 文件内部访问数据库的通常途径

    创建至数据库的 ADO 连接(ADO connection) 打开数据库连接 创建 ADO 记录集(ADO recordset) 打开记录集(recordset) 从数据集中提取你所需要的数据 关闭数 ...

  7. LeetCode 153. Find Minimum in Rotated Sorted Array (在旋转有序数组中找到最小值)

    Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e. ...

  8. iOS 11更新后以及iPhone X推出后工程中遇到的问题及适配

    1.UITableView滑动时右侧的滑动条忽长忽短的乱跳以及MJRefresh上拉刷新死循环 这是因为tableView在iOS11默认使用Self-Sizing,tableView的estimat ...

  9. Java并发编程--线程池

    1.ThreadPoolExecutor类 java.uitl.concurrent.ThreadPoolExecutor类是线程池中最核心的一个类,下面我们来看一下ThreadPoolExecuto ...

  10. C++ 多态与虚函数

    1.多态的概念 由虚函数实现的动态多态性就是:同一类族中不同类的对象,对同一函数调用作出不同的响应. 先看下面这个简单的例子: #include<iostream> using std:: ...