Monkey官方介绍,个人翻译,请随便喷我

来源:互联网 发布:上传图片的js代码 编辑:程序博客网 时间:2024/05/17 03:46

UI/Application Exerciser Monkey

用户界面/ 应用程序 健壮性 之 Monkey

The Monkey is a program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner.

Monkey是可以运行在模拟器与真机上的一个程序,可以生成随机用户事件流,比如点击、触摸、还有手势,以及一些操作系统级别的事件。使用Monkey可以对你的应用程序进行随机重复的压力测试。


Overview 简介



The Monkey is a command-line tool that you can run on any emulator instance or on a device. It sends a pseudo-random stream of user events into the system, which acts as a stress test on the application software you are developing.

Monkey是个命令行工具,可以运行在模拟器实例或者真机上。 它可以发送 随机 用户 事件到操作系统, 用作开发的应用程序上做压力测试

The Monkey includes a number of options, but they break down into four primary categories:

Monkey包括一些,他们分解成4个重要的类别:

  • Basic configuration options, such as setting the number of events to attempt.基本配置选项,比如设置要尝试的事件数量
  • Operational constraints, such as restricting the test to a single package.可用的限制,比如限制只测试单一的包
  • Event types and frequencies. 还有事件类型的频率
  • Debugging options.调试选项

When the Monkey runs, it generates events and sends them to the system. It also watches the system under test and looks for three conditions, which it treats specially:

当Monkey运行时,它生成事件并发送它们到操作系统。监视操作系统的三个条件,并特别对待:

  • If you have constrained the Monkey to run in one or more specific packages, it watches for attempts to navigate to any other packages, and blocks them. 如果你限制Monkey运行在一个或者多个明确的包, 它将监视企图打开其它包时,然后会阻止进行
  • If your application crashes or receives any sort of unhandled exception, the Monkey will stop and report the error.如果你有的应用程序崩溃或者接受一些未处理的异常,Moneky将停止,并报告这些错误
  • If your application generates an application not responding error, the Monkey will stop and report the error. 如果你的应用程序生成 ANR(application not responding error),Monkey将停止并报告这些错误

Depending on the verbosity level you have selected, you will also see reports on the progress of the Monkey and the events being generated.

根据你选择的详细级别, 你将看到关于Mnkey以及事件生成的报告进度。

Basic Use of the Monkey

Monkey的基本使用

You can launch the Monkey using a command line on your development machine or from a script. Because the Monkey runs in the emulator/device environment, you must launch it from a shell in that environment. You can do this by prefacingadb shell to each command, or by entering the shell and entering Monkey commands directly.

你可以在你的开发机或者从脚本上,运行Monkey,因为 Monkey运行在模拟器或者真机上,你必须从所处环境的shell上运行Monkey。 你可以用 adb shell当头的命令,或者进入shell,立即输入Monkey命令即可

The basic syntax is: [option]指可选项, <>内指必须输入的选项

基本语法:

$ adb shell monkey [options] <event-count>

With no options specified, the Monkey will launch in a quiet (non-verbose) mode, and will send events to any (and all) packages installed on your target. Here is a more typical command line, which will launch your application and send 500 pseudo-random events to it:

没有明确选项,Monkey将在安静模式(非详细)下运行,并在你的目标设备上发送事件到任意的已安装的包上。 这是个典型的命令行,将运行在任意一个应用程序上,并发送500个随机的事件。

$ adb shell monkey -p your.package.name -v 500

Command Options Reference可参考的命令选项


The table below lists all options you can include on the Monkey command line.

这个表里列出了你可以插入到Monkey命令行的所有选项

坑了表死活贴不上来






0 0
原创粉丝点击