python入门

import sys

device=sys.argv[1]Dateandname=sys.argv[2]

//取得传入参数

print "##########python is run ##########"
//打印

import os
os.system("touch Strategic_success " + path1)
//执行系统指令

import time
time.sleep(10)
//延时


start = time.time()
end = time.time()
if ((end - start) > 3600):  # 是否大于1小时 3600
print str((end - start))

//取得程序运行时间

def init():
 os.system("adb -s " + device + " shell  touch /sdcard/finishflag ")  # 创建标志,结束内存分陪程序
 os.system("adb -s " + device + " root")
 time.sleep(3)
 os.system("adb -s " + device + " remount")
 os.system("adb -s " + device + " push mytest /system/bin")
 os.system("adb -s " + device + " shell rm / sdcard/runtimes*")#删除次数标志
 os.system("adb -s " + device + " shell rm /sdcard/finishflag")#删除结束标志
 os.system("adb -s " + device + " shell rm -R /sdcard/test")  # 删除创建的内存

//定义函数


if os.path.exists(path1):
 print path1

else:
 os.makedirs(path1)

//if判断,创建文件夹

for i in range(1, 8):
 print "#####################################"
 print "         run " + str(i)
 print "#####################################"

//for循环


import re
alist = []
alist.append(str2)
str1 = alist.pop(0)
str2 = alist.pop(0)
str3 = alist.pop(0)
print str1
print str2
print str3
m1 = re.findall(r'(\w*[0-9]+)\w*',str1)
m2 = re.findall(r'(\w*[0-9]+)\w*',str2)
m3 = re.findall(r'(\w*[0-9]+)\w*',str3)
if m3 > m2 and m2 > m1:
 print "true"
 os.system("touch Strategic_success " + path1)
 print "touch" + path1 + "/Strategic_success"
else:
 print "false"
 os.system("touch Strategic_fail " + path1)

//把数据存入队列alist,然后从数据中去除数字,然后进行对比

app = ["com.xxx.weather2/.ActivityWeatherMain",   #天气  
"com.kugou.android/.app.splash.SplashActivity",  #酷狗音乐
]#for a in app:# sss = a.split('/')# print "包名+类名 :"+ a# print "包名 :" + sss[0]# print "替换 . :" + sss[0].replace('.','_')#测试函数def myrunmonkey(path): for a in app: strclass = a.split('/')#截取字符串 ttt = strclass[0].replace('.', '_')#把.替换成_ print "替换 . : " + ttt os.system("adb -s " + device + " shell am start " + a)#测试相机 time.sleep(isleep) #print "adb -s " + device + " shell monkey -p "+ a[0] + " --throttle 500 --pct-touch 20 --pct-motion 25 --pct-nav 20 --pct-majornav 15 --pct-appswitch 5 --pct-anyevent 15 --ignore-crashes --ignore-timeouts --monitor-native-crashes --ignore-native-crashes " + str(times) + " > " + path+"/monkeyResult_"\ # + ttt + ".log" os.system("adb -s " + device + " shell monkey -p "+ a[0] + " --throttle 500 --pct-touch 20 --pct-motion 25 --pct-nav 20 --pct-majornav 15 --pct-appswitch 5 --pct-anyevent 15 --ignore-crashes --ignore-timeouts --monitor-native-crashes --ignore-native-crashes " + str(times) + " > " + path+"/monkeyResult_" + ttt + ".log") return ;


彭志才 2016-8-7

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值