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. 如何抽象一个 Vue 公共组件

    之前一直想写一篇关于抽象 Vue 组件的随笔,无奈一直没想到好的例子.恰巧最近为公司项目做了一个数字键盘的组件,于是就以这个为例聊聊如何抽象 Vue 的组件. 先上 Demo 与 源码.(demo最好 ...

  2. UVa1599,Ideal Path

      说实话,这题参考的: http://blog.csdn.net/u013382399/article/details/38227917 倒着BFS就把我难住了T T,原来这样倒着BFS一遍,遍历完 ...

  3. PHP中提问频率最高的11个面试题和答案

    问题:请用最简单的语言告诉我PHP是什么? 回答:PHP全称:Hypertext Preprocessor,是一种用来开发动态网站的服务器脚本语言. 问题:什么是MVC? 回答:MVC由Model(模 ...

  4. Linux文件系统的层级结构

    Linux文件系统的层级结构   文件结构 倒置的树状结构 :Linux的哲学思想是一切皆文件,把几乎所有资源统统抽象为文件形式:包括硬件设备,甚至通信接口等 根目录 :linux的文件起始均从唯一的 ...

  5. js math对象总结

    1:  Math 对象用于执行数学任务. 2:Math 对象并不像 Date 和 String 那样是对象的类,因此没有构造函数 Math(), Math.sin() 这样的函数只是函数 3:通过把 ...

  6. yii2之数据验证

    一.场景 什么情况下需要使用场景呢?当一个模型需要在不同情境中使用时,若不同情境下需要的数据表字段和数据验证规则有所 不同,则需要定义多个场景来区分不同使用情境.例如,用户注册的时候需要填写email ...

  7. LeetCode 252. Meeting Rooms (会议室)$

    Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si ...

  8. java swing中Timer类的学习

    最近在完成学校课程的java平时作业,要实现一个计时器,包含开始.暂停以及重置三个功能.由于老师规定要用这个timer类,也就去学习了一下,顺便记录一下. 首先呢去查了一下java手册上的东西,发现t ...

  9. 使用Spring框架实现用户登录实例

    以下要讲的案例来自于<Spring 3.X 企业应用开发实战>这本书. 针对我一周的摸索,现在总结几个易错点,当然,这是在我自己犯过错误的前提下总结出来的,如果有说的不到位的地方,欢迎大家 ...

  10. 改变 font Awesome、Ionic 图标属性

    可使用 -webkit-text-stroke属性. 例如: -webkit-text-stroke:1px red 使用color属性,可改变 图标颜色: 例如: color: red: 使用fon ...