Exemplo n.º 1
0
 def __init__(self, dev):
     self.dev = dev
     # 设备devicesid
     #self.event = pow(10, 5)
     # 发送事件总数,100W
     self.adc = AdbCommon(self.dev)
     self.db = DateBean()
Exemplo n.º 2
0
 def __init__(self, dev):
     self.dev = dev
     # 设备devicesid
     self.event = pow(10, 5)
     # 发送事件总数,100W
     self.adc = AdbCommon(self.dev)
     self.pck = 'com.luojilab.player'
     self.activity = 'com.luojilab.business.HomeTabActivity'
     self.db = DateBean()
Exemplo n.º 3
0
def run():

    configYaml =  readyaml("Config.yml")
    apkname = configYaml["apkname"]
    # apk包名
    runtime = configYaml["runtime"]
    # monkey运行时间
    seed = configYaml["seed"]
    # monkey命令的seed值
    apkpath = configYaml["apkpath"]
    # apk路径
    throttle = configYaml["throttle"]
    # 时间间隔
    simulator = configYaml["simulator"]
    # 设备是否模拟器参数
    appdebug = configYaml["appdebug"]
    # app是否是debug
    devices = configYaml["devces"]
    # 设备号
    whitelist = configYaml["whitelist"]
    # 白名单列表
    account = configYaml["account"]
    # 登录账号
    pwd = configYaml["pwd"]
    # 登录密码
    loglevel = configYaml["loglevel"]
    # 日志等级

    adc = AdbCommon(devices)
    # 初始化AdbCommon类
    db = DateBean()
    logger.setup_logger(loglevel)
    # 设置log级别
    

    try:
        if isinstance(int(runtime), int):
            if int(runtime) > 60:
                logger.log_info('输入的运行时间太大,最大运行时间是60分钟')
            else:
                flag1 = True

    except Exception, e:
        logger.log_error('输入的runtime参数,类型必须是整数' + '\n' + '异常信息:' + str(e))
Exemplo n.º 4
0
 def __init__(self, dev):
     self.dev = dev
     self.db = DateBean()
Exemplo n.º 5
0
import logger
from flask import Flask, request
from flask import render_template
import requests
from threading import Thread
from DateBean import DateBean

rootpath = str(sys.argv[0]).split('/')
lists = list(rootpath)
del lists[-1]
newpath = '/'.join(lists)
os.chdir(newpath)
print '当前文件路径:'+os.getcwd()


mempath = os.getcwd() + '/' + DateBean().mempath
cpupath = os.getcwd() + '/' + DateBean().cpupath
networkpath = os.getcwd() + '/' + DateBean().networkpath
fpspath = os.getcwd() + '/' + DateBean().fpspath
# memer/cpu/network/fps文件路径

htmlpath = os.getcwd() + '/ReportServer/performanceReport/performance_%s.html' % time.strftime("%Y%m%d%H%M%S")
# html报告地址

host = '0.0.0.0'
port = 8888

def create_app():
    '''
    创建app
    :return:app
Exemplo n.º 6
0
def run(argv):

    apkname = ''
    # apk包名
    runtime = ''
    # monkey运行时间

    seed = ''
    # monkey命令的seed值

    apkpath = ''
    # apk路径

    throttle = ''
    # 时间间隔

    simulator = ''
    # 设备是否模拟器参数

    appdebug = ''
    # app是否是debug,如果是debug在登录的时候需要一套账号密码和release不能公用

    devices = ''
    # 设备号

    whitelist = ''
    # 白名单列表

    account = ''
    # 账号

    pwd = ''
    # 密码

    loglevel = ''
    # 日志等级

    example = 'python Run.py ' \
              '--apkname=com.luojilab.player ' \
              '--runtime=1 --seed=20 ' \
              '--throttle=20  ' \
              '--simulator=False ' \
              '--appdebug=False ' \
              '--apkpath=/Users/xinxi/PycharmProjects/android_monkey/DependApp/app_debug_3.1.9.apk' \
              '--devces=6efzky' \
              '--whitelist=com.luojilab.player.homeactivity'
    # 参考命令

    try:
        option = ['apkname=', 'runtime=', 'seed=', 'apkpath=', 'throttle=', 'simulator=', 'appdebug=','devices=','whitelist=','account=','pwd=','loglevel=']
        opts, args = getopt.getopt(argv, 'hi:o:t:n:m:q:w:d:l:a:p:z', option)

    except getopt.GetoptError:
        logger.log_error('参考命令:%s' % example)
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            logger.log_info('参考命令:%s' % example)
            sys.exit()

        elif opt in ('-i', '--apkname'):
            apkname = arg
        elif opt in ('-o', '--runtime'):
            runtime = arg
        elif opt in ('-t', '--seed'):
            seed = arg
        elif opt in ('-n', '--apkpath'):
            apkpath = arg
        elif opt in ('-n', '--throttle'):
            throttle = arg
        elif opt in ('-m', '--simulator'):
            simulator = arg
        elif opt in ('-w', '--appdebug'):
            appdebug = arg
        elif opt in ('-d', '--devices'):
            devices = arg
        elif opt in ('-l', '--whitelist'):
            whitelist = arg
        elif opt in ('-a', '--account'):
            account = arg
        elif opt in ('-p', '--pwd'):
            pwd = arg   
        elif opt in ('-z', '--loglevel'):
            loglevel = arg

    adc = AdbCommon(devices)
    # 初始化AdbCommon类
    db = DateBean()
    logger.setup_logger(loglevel)
    # 设置log级别
    
    if len(sys.argv) == len(option) + 1:
        flag1 = False
        flag2 = False
        flag3 = False
        flag4 = False
        flag5 = False
        flag6 = False
        # 设置标记
        try:
            if isinstance(int(runtime), int):
                if int(runtime) > 60:
                    logger.log_info('输入的运行时间太大,最大运行时间是60分钟')
                else:
                    flag1 = True

        except Exception, e:
            logger.log_error('输入的runtime参数,类型必须是整数' + '\n' + '异常信息:' + str(e))

        try:
            if isinstance(int(seed), int):
                flag2 = True
            else:
                logger.log_info('输入的seed参数,类型必须是整数')

        except Exception, e:
            logger.log_error('输入的seed参数,类型必须是整数'  + '\n' + '异常信息:' + str(e))
Exemplo n.º 7
0
 def __init__(self, dev):
     self.dev = dev
     # 设备devicesid
     self.db = DateBean()