Android 系統自動化Monkey測試

def runSys(): #核心部分:循環操作(SystemSilence——>SystemMonkey——>App1 Silence——>App1 Monkey——>App2 Silence ——App2 Monkey)
	while True:
		#timestr=time.asctime( time.localtime(time.time()) )
		#print(timestr+"runSysSilence。。。")
		time.sleep(0.5*60*60) #keep silence for 30m
		time.sleep(10)
		#timestr=time.asctime( time.localtime(time.time()) )
		#print(timestr+"runSysMonkey")
		os.system("adb shell monkey -s 120 --ignore-timeouts --ignore-crashes --ignore-security-exceptions --pct-touch 85 --pct-syskeys 7  --pct-majornav 5 --ignore-native-crashes --monitor-native-crashes --throttle 300 -v -v -v 5000 >d:/monkeylog/sysmonkey.txt")  #run monkey 
		#print(time.asctime( time.localtime(time.time()) )+"runSysMonkey ——> Finished")
		i=0
		while i<len(aclist):
			timestr=time.asctime( time.localtime(time.time()) )
			print(timestr+"runAPPSilence。。。"+packagenamelist[i].strip("\n"))
			cmdstart="adb shell am start -n "+aclist[i].strip("\n")
			cmdmonkey="adb shell monkey -p "+packagenamelist[i].strip("\n")+" --throttle 300 --pct-touch 90 -v -v -v 2000>> d:/monkeylog/"+packagenamelist[i].strip("\n")+".monkey.txt"  #Run Monkey 10min
			os.system(cmdstart)
			time.sleep(600) # App[i] Start Silence Time 10min
			timestr=time.asctime( time.localtime(time.time()) )
			print(timestr+"runAPPMonkey。。。"+packagenamelist[i].strip("\n"))
			os.system(cmdmonkey) #App[i] Start Monkey 
			time.sleep(10)
			i+=1

 

上一篇:Charpter02 策略模式


下一篇:平台支持monkey命令并过滤日志展示-安卓