入门monkeyrunner3-官方文档第二部分

发表于:2015-11-05 11:12

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:Mr.Dantes    来源:51Testing软件测试网采编

  Arguments
  path 中的完全限定路径和文件名??的.apk文件进行安装。
  dictionary instrument ( string className, dictionary args)
  运行了Android仪器指定的组件,并返回结果在字典中的具体格式由组件正在运行所决定的。该组件必须已经存在此设备上。
  使用这种方法来启动一个测试用例,使用Android的测试用例类之一。请参见测试基础,以了解更多关于单元测试与Android测试框架。
  Arguments
  className 已安装此设备上,在标准格式软件包名/类名,其中包名是的Android包名称的Android的组件的名称.apk文件在此设备上的文件,类名是一个Android组件的类名(活动,ContentProvider的,服务,或BroadcastReceiver的),在该文件中。这两个包名和类名必须是完全合格的。看到 组件名的更多细节。
  args 字典包含标记和他们的价值观。这些被传递到组件,因为它被启动。如果标志不采取价值,它的字典值设置为空字符串。
  Returns
  字典包含组件的输出。字典的内容由组件本身定义的。
  如果您使用InstrumentationTestRunner的组件名参数作为类名,然后将结果字典包含单键“流”。“流”的值是一个字符串,包含测试输出,仿佛InstrumentationTestRunner是在命令行中运行。此输出的格式中描述 的测试中其他的IDE。
  void press (string name, integer type)
  通过发送指定的关键事件类型由指定的键 的键码。
  Arguments
  name 发送键码的名称。见的KeyEvent为键码名称的列表。使用的键码的名字,而不是它的整数值。
  type 送的键事件的类型。允许的值是 DOWN,UP和 DOWN_AND_UP。
  void reboot (string bootloadType)
  重新启动该设备进入由指定的引导程序bootloadType。
  Arguments
  into 引导程序的类型重启进入。允许的值是“引导程序”,“恢复”或“无”。
  void removePackage (string package)
  从该设备删除指定的软件包,包括数据和缓存。
  Arguments
  package 的的Android包名.apk文件在此设备上的文件。
  object shell (string cmd)
  执行一个ADB shell命令并返回结果,如果有的话。
  Arguments
  CMD 该命令在执行亚行的shell。这些命令的形式,题目中所描述的Android调试桥。
  return
  该命令的结果,如果有的话。结果的格式由命令确定。
  cmd The command to execute in the adb shell. The form of these commands is described in the topic Android Debug Bridge.
  Returns
  The results of the command, if any. The format of the results is determined by the command.
  void startActivity ( string uri, string action, string data, string mimetype, iterable categoriesdictionary extras, component component, iterable flags)
  通过发送从提供的参数构建一个Intent启动该设备上的活动。
  Arguments
  uri The URI for the Intent. (see Intent.setData()).
  action The action for the Intent (see Intent.setAction()).
  data The data URI for the Intent (see Intent.setData()).
  mimetype The MIME type for the Intent (see Intent.setType()).
  categories An iterable data structure containing strings that define categories for the Intent (seeIntent.addCategory()).
  extras A dictionary of extra data for the Intent (see Intent.putExtra() for an example).
  The key for each dictionary item should be a string. The item's value can be any simple or structured data type.
  component The component for the Intent (see ComponentName). Using this argument will direct the Intent to a specific class within a specific Android package.
  flags An iterable data structure containing flags that control how the Intent is handled (seeIntent.setFlags()).
  MonkeyImage takeSnapshot ()
  抓住了这个装置的整个屏幕缓冲区,得到当前显示的屏幕截图。
  回报
  一个 MonkeyImage包含当前显示的图像对象。
  void touch ( integer x, integer y, string type)
  发送按类型对由x和y指定的屏幕位置指定到触摸事件。
  Arguments
  x 触摸在实际设备的像素的水平位置,从在其当前方向在屏幕的左边开始。
  y 触摸在实际设备的像素的垂直位置,从屏幕中其当前方向的顶部开始。
  type 送的键事件的类型。允许的值是 DOWN,UP和 DOWN_AND_UP。
  void type (string message)
  发送包含在消息中的字符这个设备,就好像他们已经输入设备的键盘上。这等同于调用 按()在每个键码信息 利用的关键事件类型DOWN_AND_UP。
  参数
相关文章:
入门monkeyrunner2-官方文档第一部分
22/2<12
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号