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. ActivityManager与Proxy模式的运用

    Android学习——ActivityManager与Proxy模式的运用 一 Proxy模式 意图: 为其他对象提供一种代理以控制这个对象的访问. 适用性: l  远程代理( Remote Prox ...

  2. win10 uwp 异步进度条

    本文主要讲我设计的几个进度条,还有如何使用异步控制进度条,如何使用动画做进度. 进度条可以参见:http://edi.wang/post/2016/2/25/windows-10-uwp-modal- ...

  3. Python+OpenCV图像处理(一)

    Python+OpenCV图像处理(一): 读取,写入和展示图片 调用摄像头拍照 调用摄像头录制视频 1. 读取.写入和展示图片 图像读入:cv2.imread() 使用函数cv2.imread() ...

  4. 小星星的php

    大家好,我是小星星,最近新学的php,我迫不及待要跟大家分享了!!come on!一起来看小星星的世界 先为大家介绍php基础 首先我们来看看什么叫php: PHP(外文名:PHP: Hypertex ...

  5. 基于FFMPEG的跨平台播放器实现(二)

    基于FFMPEG的跨平台播放器实现(二) 上一节讲到了在Android平台下采用FFmpeg+surface组合打造播放器的方法,这一节讲一下Windows平台FFmpeg + D3D.Linux平台 ...

  6. UVa1605,Building for UN

    我比较好奇的是uva后台是怎么测这题的 没什么可说的,那些不想敲但还是想直接交这题的直接copy过去吧 #include <iostream> #include <cstring&g ...

  7. angular.js基础

    内置指令 所有的内置指令的前缀都为ng,不建议自定义指令使用该前缀,以免冲突.首先从一些常见的内置指令开始.先列出一些关键的内置指令,顺便简单说说作用域的问题. ng-model 将表单控件和当前作用 ...

  8. Java基础笔记13

    1.集合与对象数组的区别 集合与对象数组共同点:都是存放对象的容器: 区别在于:①集合是没有长度限制的:②集合容器中没有类型的限制. 2.集合(都在Java.util包下) 常用的集合:Collect ...

  9. Here We Go(relians) Again

    Here We Go(relians) Again Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/O ...

  10. 使用Identity Server 4建立Authorization Server (2)

    第一部分: http://www.cnblogs.com/cgzl/p/7780559.html 第一部分主要是建立了一个简单的Identity Server. 接下来继续: 建立Web Api项目 ...