MonkeyRunner script

[android官方]

经常用来做压力测试的话,脚本必不可少;

带UI挂工程的就算啦(么必要像CTS那么认真嘛,动不动tearDown),简单直接最好~

MonkeyRunner完全符合条件,直接上无限单击的脚本(Python),对照着改改坐标就好使了:

from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice

_COUNT = 0

def take_picture(device):
	global _COUNT
	_COUNT += 1
	note = "%s%d%s" % ('take the ', _COUNT, ' times.')
	print note
	device.touch(720, 2300, MonkeyDevice.DOWN_AND_UP)
	
def main():
	_device = MonkeyRunner.waitForConnection()
	print  'opening'

	while True:
		take_picture(_device)
		MonkeyRunner.sleep(3.5)

main();

脚本跑起来,开个窗口看log,空下来一会就可以记录一下(不然保持目前干活的节奏~ 会很久不更新的~)