Intrumentation类:ActivityInstrumentationTestCase2学习(1)
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后,该构造方法被下方的方法取代了)
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)的更多相关文章
- php大力力 [019节]php分页类的学习
2015-08-26 php大力力019.php分页类的学习 [2014]兄弟连高洛峰 PHP教程14.2.1 分页需求分析 14:18 [2014]兄弟连高洛峰 PHP教程14.2.2 分页类中分页 ...
- 20175212童皓桢 在IDEA中以TDD的方式对String类和Arrays类进行学习
20175212童皓桢 在IDEA中以TDD的方式对String类和Arrays类进行学习 要求 在IDEA中以TDD的方式对String类和Arrays类进行学习 测试相关方法的正常,错误和边界情况 ...
- Exception类的学习与继承总结
日期:2018.11.11 星期日 博客期:023 Exception类的学习与继承总结 说起来我们上课还是说过的!老师提到了报错问题出现主要分Exception和Error两类!第一次遇见这个问题是 ...
- 20155312张竞予 20170510实践一:在IDEA中以TDD的方式对String类和Arrays类进行学习
实践题目 在IDEA中以TDD的方式对String类和Arrays类进行学习 测试相关方法的正常,错误和边界情况 String类 charAt split Arrays类 sort binarySea ...
- 20155326 第12周课堂实践总结(二)String类和Arrays类的学习
20155326 第12周课堂实践总结(二)String类和Arrays类的学习 实践二 Arrays和String单元测试 实践题目 在IDEA中以TDD的方式对String类和Arrays类进行学 ...
- 06.FileStream类的学习
//FileStream类是用来操作字节的,也就是可以操作所有文件. 因为所有的文件都是以字节形式来存储的. //StreamReader类和StreamWriter类是用来操作字符的. FileSt ...
- 05.File类的学习
File 是文件的意思 File类是一个静态类,所以File类是一个工具类 File类是专门操作文件的类 File的常用方法 namespace _16.File类的学习 { class Progr ...
- 04.Path类的学习
path 是路径的意思. path类是一个静态类,所以path是一个工具类. Path类是专门用来操作路径的. Path的常用方法: namespace _15.Path类的学习 { class Pr ...
- getID3类的学习使用
getID3类的学习使用 网上描述: getID3()这个PHP脚本能够从MP3或其它媒体文件中提取有用的信息如:ID3标签,bitrate,播放时间等. (格式包括:Ogg,WMA,WMV,ASF, ...
随机推荐
- 使用C#系统服务定时执行操作
1.新建项目 --> Windows 服务 2.Service1.cs代码 using System; using System.Collections.Generic; using Syste ...
- python爬虫之获取验证码登陆
#--coding:utf-8#author:wuhao##这里我演示的就是本人所在学校的教务系统#import urllib.requestimport urllib.parseimport rei ...
- 吾八哥学Python(一):搭建Python开发环境(Windows)
学习Python的第一步当然是要配置一下开发环境了,这里记录一下本人在windows 10(64位)下配置Python开发环境的过程,供跟我一样的新手参考一下. 一.下载Python安装包 目前最新的 ...
- 我的第一个python web开发框架(11)——工具函数包说明(二)
db_helper.py是数据库操作包,主要有两个函数,分别是read()数据库读操作函数和write()数据库写操作函数.这个包的代码是从小戴同学分享的博文改造过来的. #!/usr/bin/env ...
- Tomcat Java.OutOfMemoryError : PermGen Space异常
背景:前些日子更新公司多年前一个旧平台发布到Tomcat上之后,频繁收到网站许多模块无法正常使用的反汇. 测试过程中发现平台发布一段时间后,访问相关网页出现如下500页面 解决方案:PermGen s ...
- python第四课——线程、进程、协程
面试or笔试题:简述线程.进程.协程之间的关系? 内容概要 1.进程与线程优.缺点的比较 2.适用情况 3.线程 线程的创建 setDaemon join event RLock 队列 4.进程 创建 ...
- Stack by pointer
前言:因为栈的很多操作是基于表的,所以这篇文章里的例程就不再大面积地写注释了,有不理解的地方可以翻看之前的链表笔记,或者直接写在评论区. 咳咳,说到这个栈,很多人乍听之下感觉很陌生.卧槽这是什么玩意. ...
- mysql 安装配置
l 下载压缩包: 官网下载地址:https://dev.mysql.com/downloads/mysql/5.1.html#downloads 第一步: 将下载的压缩包解压到你要安装的目录下 第二 ...
- SQL查询一个表里面某个字段值相同的数据记录
好长时间没有用SQL了...还停留在学生时代的水平... 转: 昨天遇到个面试题:查询一个表里面某个字段值相同的数据记录,好久没有写过这种,还真的花了点时间才写出来.如表g_carddetail,有 ...
- 数据库无法连接JDBC
解决:Connections could not be acquired from the underlying database! 博客分类: 问题解决 数据库 iBatis og4j:WARN ...