wrapEasyMonkey 2.0 released

2.0 version is released . copyright(c) whoistester.com
new 新特性:
1. don’t need set the env vars anymore
不需要再设置wrapeasymonkey的环境变量了
2. just put the lib into the android sdk tools lib directory
只需要将wrapeasymonkey的lib 放到 android sdk 的tools文件夹里的lib目录里,就可以使用,简单。
3. write the test case with python code , and monkeyrunner run it.
写测试用例代码,并用monkeyrunner 执行该case

Pre-use: 前提:
1. you have the android sdk installed.
你需要android sdk 安装
2. download the wrapEasyMonkey 2.0 from sourceforge
下载wrapeasymonkey 2.0 并放到正确的lib目录下

Install the lib 安装lib:
1. unzip the downloaded file and extract the wrapeasymonkey.jar.
解压,并拿到wrapeasymonkey.jar
2. mv the jar to the lib directory of the android sdk tools dir.
将jar移动到 android sdk 的tools文件夹里的lib目录里
How to use: 如何使用

1. write the python code folow the examples , and monkeyrunner it.

It’s easy to test the android.

Known isues: 已知问题
1. couldn’t simultaneously run multi test process on multi devices. 经过试验, 同一个脚本不能同时在多个设备上运行. 该问题经分析应为monkeyrunner及android底层问题. 当同时执行时,既传入的deviceid 不同,但会发现发送的event会串. 既发给a设备的key动作,有时会串到b设备.
2. couldn’t locate the coordinate of the dialog button , you should use the direction press to chose ok or cancel and context menu instead . 系统对话框的坐标不能通过id进行定位, 需要通过发送方向键,来定位并进行触摸touch.

testcase examples: 测试用例示例代码:

'''
Copyright (C) 2012
@author: nighteblis%hotmail.com (% to @)
'''
#code begain here
from com.whoistester.android.testimport import os,sys,re,string,locale,ViewClient,wrapEasyMonkey,MonkeyDevice,MonkeyRunner,EasyMonkeyDevice,By
package = 'com.whoistester.android'
activity = '.account.login'
component = package + "/" + activity
deviceId=sys.argv[1] ###### If you know your deviceid , please give a constant string
mydevice = wrapEasyMonkey(deviceId)
mydevice.startActivity(component)
mydevice.caseManager.setResultPath('/test/testresult')  ## the location where you want the result to be in
mydevice.caseManager.testSetup()
for yy in range(1):
     ''''''''''''''''''''''''''
     #case 1
     ''''''''''''''''''''''''''
 

     mydevice.caseManager.caseStart('login')

     mydevice.clearTextById('id/theaccount')

     mydevice.caseManager.saveCaseStatus('')  # take a snap shot

     mydevice.type('nighteblis')

     mydevice.press('KEYCODE_AT',mydevice.DOWN_AND_UP)

     mydevice.type('hotmail.com')

     mydevice.clearTextById('id/thepassword')

     mydevice.type('mypassword')

     mydevice.press('KEYCODE_BACK',mydevice.DOWN_AND_UP)

     mydevice.caseManager.saveCaseStatus('')

     mydevice.touchViewById('id/login_button',mydevice.DOWN_AND_UP)

     mydevice.caseManager.assertText('id/setpassword','set your password')

     mydevice.caseManager.saveCaseStatus('')

     mydevice.caseManager.caseEnd()

此篇文章已被阅读6134 次

5 Comments

Add a Comment

邮箱地址不会被公开。 必填项已用*标注