Pro App Restart
App * Restart
app.restart自动检测当前app的运行状态,停止app并重启。然后等待MonkeyTalk重连。
默认超时:15s,重启成功直到MonkeyTalk重新建立连接的时间,通常时间充足。该命令可以加一个参数,来修改超时时间:
App * Restart 30
上边的命令是,app重启成功等待超时时间为30秒。
多设备控制
新版本中,MonkeyTalk在执行单个测试过程中,可以连接多个设备。这个特点使单个测试跨设备执行。例如,你可以利用这个特点测试一个聊天app或者一个短信app,一个设备发送信息,另一个设备接收信息。提示:此功能将不会被用来在多个并行的设备上同时运行相同的脚本,而是 see theCloudMonkeyLabManager.
MonkeyTalk Pro包含一个新的设备监听方式:
%device=<DEVICEID>
DEVICEID可以是下边的任意一种:
· The IP:PORT of an iOS or Android networked device. In general, iOS deviceswill be on port 16863 and Android devices will be on port 16862. If you areusing an iOS Simulator, a tethered Android device, or Android emulator, the IPwill be "localhost".
· The Android serial number for a tethered Android device. For Androidemulators, this will be the identifier which appears in the reponse to the"adb devices" command, e.g. "emulator-5554".
没有通过%device指定设备时,MonkeyTalk默认连接的是已连接好的设备。
# Run the commands on the attached device
Button LOGIN Tap
# Run on a Android emulator (with ADB serial emulator-5554)
Button LOGIN Tap %device=emulator-5554
# Run on an Android emulator over a differnt port
# (setup forwarding: adb -s emulator-5554 forward tcp:9001 tcp:16862)
Button LOGIN Tap %device=localhost:9001
# Run on a tethered Android device (with ADB serial FD67364E66B298)
Button LOGIN Tap %device=FD67364E66B298
# Run on an untethered Android device over WiFi
# (PC and Android device must be on *same* WiFi network)
Button LOGIN Tap %device=10.31.2.31:16862
# Run on the iOS simulator
Button LOGIN Tap %device=localhost:16863
# Run on an iOS device over WiFi
# (PC and iOS device must be on *same* WiFi network)
Button LOGIN Tap %device=10.31.2.25:16863
运用全局变量(see Global Variables)的参数化脚本(seeParameterized Scripts):
Vars * Define galaxyS3="10.31.2.31:16862" iphone5="10.31.2.25:16863"
Input msg EnterText "Hi, Fred!" %device=${galaxyS3}
View output Verify "Hi, Fred!" %device=${iphone5}
Input msg EnterText "l8r bob" %device=${iphone5}
View output VerifyWildcard "*l8r bob*" %device=${galaxyS3}
程序控制
新版本的MonkeyTalkPro IDE集成了应用程序控制。Install, launch, relaunch, and uninstall可以直接从IDE界面操作。目前该功能只支持Android系统。
程序控制按钮如图:
首先,选择要管理的应用程序。选定的应用程序将与该项目关联起来。当你改变项目时,管理的应用程序也被改变了。
然后,用下面可用的命令:
· Launch
· Install
· Stop
· Uninstall
· Information
Information显示您在计算机上的应用程序的位置,主要活动名称,应用程序包名称等等。