首页 > 代码库 > MonkeyRunner (三)

MonkeyRunner (三)

Running monkeyrunner


You can either run monkeyrunner programs from a file, or enter monkeyrunner statements in an interactive session. You do both by invoking the monkeyrunner command which is found in the tools/ subdirectory of your SDK directory. If you provide a filename as an argument, the monkeyrunner command runs the file‘s contents as a Python program; otherwise, it starts an interactive session.

你能用一个代码文件运行monkeyrunner,也能在交互进程中输入monkeyrunner语句运行monkeyrunner.不论使用哪种方式,您都需要调用SDK目录的tools子目录下的monkeyrunner命令。如果你提供了一个文件名作为运行参数,monkeyrunner 将这个文件内容作为python程序并运行,否则它将提供一个交互对话环境.

The syntax of the monkeyrunner command is

monkeyrunner命令语法为:

?
1
monkeyrunner -plugin <plugin_jar> <program_filename> <program_options>

  

Table 1 explains the flags and arguments.

表1解释了标志和参数.

Table 1. monkeyrunner flags and arguments.

Argument Description
-plugin <plugin_jar> (Optional) Specifies a .jar file containing a plugin for monkeyrunner. To learn more about monkeyrunner plugins, see Extending monkeyrunner with plugins. To specify more than one file, include the argument multiple times.
<program_filename> If you provide this argument, the monkeyrunner command runs the contents of the file as a Python program. If the argument is not provided, the command starts an interactive session.
<program_options> (Optional) Flags and arguments for the program in <program_file>.
Argument Description
-plugin <plugin_jar>

(可选的)指定一个包含monkeyrunner插件的.jar文件.想了解更多的monkeyrunner插件,看使用插件扩展monkeyrunner.要指定更多的文件,要包含参数很多次.

<program_filename> 如果你提供这个参数,monkeyrunner会把文件作为python程序运行.如果参数为提供,命令将开启交互进程
<program_options> (可选的)<程序文件>所需的标志和参数

monkeyrunner Built-in Help


You can generate an API reference for monkeyrunner by running:

你能通过monkeyrunner运行下列语句生成一个API的参考:

?
1
monkeyrunner help.py <format><outfile>

The arguments are:

参数是:

  • <format> is either text for plain text output or html for HTML output.
  • <outfile> is a path-qualified name for the output file.

  <format> 可选text或是html, 输出text或是HTML文件.

  <outfile> 是指定输出路径名.