def generate_test_data(devices): dict_tmp = {} for d in devices: print(d['udid']) dict_tmp[d['serial']] = {} dict_tmp[d['serial']]['user_name'] = ReadConfig().get_testdata('user_name')[devices.index(d)] dict_tmp[d['serial']]['password'] = ReadConfig().get_testdata('password')[devices.index(d)] with open(data_path, "w") as f: json.dump(dict_tmp, f) f.close() print("Test data data.json generated success")
def setUpClass(cls): cls.d.app_clear('com.vova.android') cls.d.app_start("com.vova.android") cls.test_data = get_test_data(cls.d) cls.watch_device("Pretty Sure|GET IT!|总是允许|Baik, saya paham.") BaseSteps.init_app_operation() cls.test_env = ReadConfig().get_test_env()
def _run_cases(run, cases): log = Log() log.set_logger(run.get_device()['model'], run.get_path() + '/' + 'client.log') log.i('udid: %s' % run.get_device()['udid']) # set cls.path, it must be call before operate on any page path = ReportPath() path.set_path(run.get_path()) # set cls.driver, it must be call before operate on any page base_page = BasePage() # base_page.set_driver(run.get_device()['ip']) if 'ip' in run.get_device(): base_page.set_driver(run.get_device()['ip']) else: base_page.set_driver(run.get_device()['serial']) try: # 运行前准备 base_page.set_fastinput_ime() # 设置fastime输入法 # base_page.d.shell('rm -rf /sdcard/DCIM/XiaoYingLite') # 删除之前的导出视频 # base_page.d.shell('rm -rf /sdcard/XiaoYingLite') # 删除之前的导出视频 base_page.d.shell('logcat -c') # 清空logcat # 开始执行测试 run.run(cases) # 结束后操作 base_page.unwatch_device() base_page.set_original_ime() base_page.identify() # 将logcat文件上传到报告 base_page.d.shell('logcat -d > /sdcard/logcat.log') time.sleep(2) base_page.d.pull('/sdcard/logcat.log', os.path.join(path.get_path(), 'logcat.log')) time.sleep(5) if ReadConfig().get_method().strip() in ["UDID", "SERVER2"]: log.i('release device %s ' % run.get_device()['serial']) atxserver2(ReadConfig().get_server_url()).release_device( run.get_device()['serial']) else: pass except AssertionError as e: log.e('AssertionError, %s' % e)
def run(self, cases): # 根据method 获取android设备 method = ReadConfig().get_method().strip() if method == 'SERVER': # get ATX-Server Online devices # devices = ATX_Server(ReadConfig().get_server_url()).online_devices() print('Checking available online devices from ATX-Server...') devices = get_online_devices() print('\nThere has %s alive devices in ATX-Server' % len(devices)) elif method == 'IP': # get devices from config devices list print('Checking available IP devices from config... ') devices = get_devices() print('\nThere has %s devices alive in config IP list' % len(devices)) elif method == 'USB': # get devices connected PC with USB print('Checking available USB devices connected on PC... ') devices = connect_devices() print('\nThere has %s USB devices alive ' % len(devices)) else: raise Exception('Config.ini method illegal:method =%s' % method) if not devices: print('There is no device found,test over.') return # # 测试前准备 # generate_test_data(devices) # 创建测试数据 data.js # download_apk() # 下载小影最新的apk print('Starting Run test >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>') runs = [] for i in range(len(devices)): runs.append(RunCases(devices[i])) # run on every device 开始执行测试 pool = Pool(processes=len(runs)) for run in runs: pool.apply_async(self._run_cases, args=(run, cases,)) time.sleep(2) print('Waiting for all runs done........ ') pool.close() pool.join() print('All runs done........ ') ChromeDriver.kill() # Generate statistics report 生成统计测试报告 将所有设备的报告在一个HTML中展示 # apk = get_apk() # apk_info = get_apk_info(apk['apk_path']) # 获取apk信息 # title = "ApkUrl: %s<br />PackageName: %s<br /> Version: V%s<br />VersionCode: %s" % ( # apk['html'], apk_info["package"], apk_info["versionName"], apk_info["versionCode"]) # create_statistics_report(runs, title=title) create_statistics_report(runs)
def _run_maxim(run, cases, command, actions, widget_black): log = Log() log.set_logger(run.get_device()['model'], os.path.join(run.get_path(), 'client.log')) log.i('udid: %s', run.get_device()['udid']) # set cls.path, it must be call before operate on any page path = ReportPath() path.set_path(run.get_path()) # set cls.driver, it must be call before operate on any page base_page = BasePage() if 'ip' in run.get_device(): base_page.set_driver(run.get_device()['ip']) else: base_page.set_driver(run.get_device()['serial']) try: # run cases base_page.d.shell('logcat -c') # 清空logcat if cases: run.run_cases(cases) Maxim().run_monkey(monkey_shell=command, actions=actions, widget_black=widget_black) base_page.d.shell('logcat -d > /sdcard/logcat.log') time.sleep(1) base_page.d.pull('/sdcard/logcat.log', os.path.join(path.get_path(), 'logcat.log')) base_page.d.pull('/sdcard/monkeyerr.txt', os.path.join(path.get_path(), 'monkeyerr.txt')) base_page.d.pull('/sdcard/monkeyout.txt', os.path.join(path.get_path(), 'monkeyout.txt')) base_page.set_original_ime() base_page.identify() if ReadConfig().get_method().strip() in ["UDID", "SERVER2"]: log.i('release device %s ' % run.get_device()['serial']) atxserver2(ReadConfig().get_server_url()).release_device( run.get_device()['serial']) else: pass except AssertionError as e: log.e('AssertionError, %s', e)
def check_alive(device): if isinstance(device, dict): if 'ip' in device: # atx-server d = u2.connect(device['ip']) if d.agent_alive: d.healthcheck() if d.alive: print('%s is alive' % device['udid']) print('atxagentUrl: %s:7912' % device['ip']) dict_tmp = d.device_info dict_tmp['ip'] = device['ip'] return dict_tmp else: print('%s is not alive' % device['udid']) return None else: print('The device %s atx_agent is not alive,please checkout!' % device['udid']) return None else: # atxserver2 d = u2.connect(device['source']['atxAgentAddress']) if d.agent_alive: d.healthcheck() if d.alive: print('%s is alive' % device['udid']) print('atxagentUrl: %s' % device['source']['atxAgentAddress']) dict_tmp = d.device_info dict_tmp['ip'] = device['source']['atxAgentAddress'] atxserver2(ReadConfig().get_server_url()).using_device(device['udid']) return dict_tmp else: print('%s is not alive' % device['udid']) return None else: print('The device %s atx_agent is not alive,please checkout!' % device['udid']) return None else: d = u2.connect(device) if d.agent_alive: d.healthcheck() if d.alive: if re.match(r"(\d+\.\d+\.\d+\.\d)", device): # config ip dict_tmp = d.device_info dict_tmp['ip'] = device print('%s is alive' % device) print('atxagentUrl: %s:7912' % device) else: # usb devices dict_tmp = d.device_info return dict_tmp else: print('%s is not alive' % device) return None else: print('The device atx_agent %s is not alive,please checkout!' % device) return None
def run(self, cases): # 根据method 获取android设备 method = ReadConfig().get_atx_server('method').strip() if method == 'host': # get ATX-Server Online devices devices = ATX_Server(ReadConfig().get_url()).online_devices() print('\nThere has %s online devices in ATX-Server' % len(devices)) elif method == 'devices': # get devices from config devices list devices = get_devices() print('\nThere has %s devices alive in config list' % len(devices)) else: raise Exception('Config.ini method illegal:method =%s' % method) if not devices: print('There is no device found') return # generate test data data.json 准备测试数据 generate_test_data(devices) print('Starting Run test >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>') runs = [] for i in range(len(devices)): runs.append(RunCases(devices[i])) # run on every device 开始执行测试 pool = Pool(processes=len(runs)) for run in runs: pool.apply_async(self._run_cases, args=( run, cases, )) print('Waiting for all runs done........ ') pool.close() pool.join() print('All runs done........ ') ChromeDriver.kill() # Generate statistics report 生成统计测试报告 将所有设备的报告在一个HTML中展示 create_statistics_report(runs)
def generate_test_data(devices): dict_tmp = {} test_env = ReadConfig().get_test_env() if test_env == "test": env = "TESTDATA" elif test_env == "pre": env = "PRETESTDATA" else: return for d in devices: dict_tmp[d['serial']] = {} for i in ReadConfig().get_all_option(env): if i.endswith('attr'): dict_tmp[d['serial']][i] = ReadConfig().get_testdata(env, i) else: dict_tmp[d['serial']][i] = ReadConfig().get_testdata(env, i)[devices.index(d)] with open(data_path, "w") as f: json.dump(dict_tmp, f, ensure_ascii=False) f.close() print("Test data data.json generated success")
def _run_cases(run, cases): log = Log() log.set_logger(run.get_device()['model'], os.path.join(run.get_path(), 'client.log')) log.i('udid: %s' % run.get_device()['udid']) # set cls.path, it must be call before operate on any page path = ReportPath() path.set_path(run.get_path()) # set cls.driver, it must be call before operate on any page base_page = BasePage() if 'ip' in run.get_device(): base_page.set_driver(run.get_device()['ip']) else: base_page.set_driver(run.get_device()['serial']) try: # run cases base_page.set_fastinput_ime() base_page.d.shell('logcat -c') # 清空logcat run.run(cases) # 将logcat文件上传到报告 base_page.d.shell('logcat -d > /sdcard/logcat.log') time.sleep(1) base_page.d.pull('/sdcard/logcat.log', os.path.join(path.get_path(), 'logcat.log')) base_page.set_original_ime() base_page.identify() if ReadConfig().get_method().strip() in ["UDID", "SERVER2"]: log.i('release device %s ' % run.get_device()['serial']) atxserver2(ReadConfig().get_server_url()).release_device( run.get_device()['serial']) else: pass except AssertionError as e: log.e('AssertionError, %s', e)
def setUpClass(cls): cls.d.app_clear('com.vova.android') cls.d.app_start("com.vova.android") # 无注册case别在watch中增加Shop Now,否则购物车为空时,会默认点击,返回上个页面在加车成功之前 cls.watch_device( "Pretty Sure|Sure|Baik, saya paham.|GET IT!|总是允许|始终允许") cls.test_data = get_test_data(cls.d) cls.test_env = ReadConfig().get_test_env() BaseSteps.init_app_operation() BaseSteps.user_login(cls.test_data['user_name_02'], cls.test_data['password_02']) cls.PAN = "EHFGA5967A" cls.CPF = '12649239700'
def run(self, cases): # 根据method 获取android设备 method = ReadConfig().get_method().strip() if method == 'SERVER': # get ATX-Server Online devices # devices = ATX_Server(ReadConfig().get_server_url()).online_devices() print('Checking available online devices from ATX-Server...') devices = get_online_devices() print('\nThere has %s online devices in ATX-Server' % len(devices)) elif method == 'IP': # get devices from config devices list print('Checking available IP devices from config... ') devices = get_devices() print('\nThere has %s devices alive in config IP list' % len(devices)) elif method == 'USB': # get devices connected PC with USB print('Checking available USB devices connected on PC... ') devices = connect_devices() print('\nThere has %s USB devices alive ' % len(devices)) else: raise Exception('Config.ini method illegal:method =%s' % method) if not devices: print('There is no device found,test over.') return # generate test data data.json 准备测试数据 generate_test_data(devices) print('Starting Run test >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>') runs = [] for i in range(len(devices)): runs.append(RunCases(devices[i])) # run on every device 开始执行测试 pool = Pool(processes=len(runs)) for run in runs: pool.apply_async(self._run_cases, args=( run, cases, )) print('Waiting for all runs done........ ') pool.close() pool.join() print('All runs done........ ') ChromeDriver.kill()
def get_devices(): '''get the devices from Pubilc/config.ini devices list return alive devices''' devices_ip = ReadConfig().get_devices_ip() print('Start check devices from config devices IP list: %s' % devices_ip) pool = Pool(processes=len(devices_ip)) tmp_list = [] for run in devices_ip: tmp_list.append(pool.apply_async(check_alive, args=(run, ))) pool.close() pool.join() devices_list = [] for i in tmp_list: if i.get(): devices_list.append(i.get()) return devices_list
def present_udid_devices(self, **kwargs): kwargs['headers'] = {"Authorization": "Bearer " + token} present_udid_devices_list = [] for udid in ReadConfig().get_server_udid(): self.refresh() self.find(where('udid') == udid).devices() device = self.find(where('present') == True).devices() if device: present_udid_devices_list.append( requests.get(self._url + '/api/v1/user/devices/' + udid, **kwargs).json()['device']) else: pass if len(present_udid_devices_list) > 0: return present_udid_devices_list else: return False
def get_online_devices(): '''get the devices from ATX-Server return alive devices''' devices = ATX_Server(ReadConfig().get_server_url()).online_devices() print('There has %s online devices on ATX-Server' % len(devices)) if devices: pool = Pool(processes=len(devices)) tmp_list = [] for run in devices: tmp_list.append(pool.apply_async(check_alive, args=(run, ))) pool.close() pool.join() devices_list = [] for i in tmp_list: if i.get(): devices_list.append(i.get()) return devices_list else: raise Exception('ATX-Server has no online device!!! ')
def get_devices(): '''get devices from Pubilc/config.ini devices list''' devices_ip = ReadConfig().get_devices() print('Getting devices from config devices list %s' % devices_ip) devices_list = [] for i in devices_ip: device = u2.connect(i) try: if device.alive: dict_tmp = device.device_info dict_tmp['ip'] = i devices_list.append(dict_tmp) else: print('The IP %s device is not alive,please checkout!' % i) except Exception as e: print( 'Raise ERR %s\nThe IP %s device is not alive,please checkout!' % (e, i)) return devices_list
def get_devices(): '''get the devices from Pubilc/config.ini devices list return alive devices''' devices_ip = ReadConfig().get_devices_ip() print('Connect devices from config devices IP list %s' % devices_ip) devices_list = [] for i in devices_ip: try: device = u2.connect(i) # device.reset_uiautomator() if device.agent_alive: device.healthcheck() if device.alive: dict_tmp = device.device_info dict_tmp['ip'] = i devices_list.append(dict_tmp) else: print('The IP %s device is not alive,please checkout!' % i) except Exception as e: print('Raise ERROR %s\nThe IP %s device is not alive,please checkout!' % (e, i)) return devices_list
def get_online_devices(): '''get the devices from ATX-Server return alive devices''' devices = ATX_Server(ReadConfig().get_server_url()).online_devices() # print('Connect devices from config devices IP list %s' % devices_ip) devices_list = [] if devices: for i in devices: try: device = u2.connect(i['ip']) if device.agent_alive: device.healthcheck() if device.alive: devices_list.append(i) else: print('The device %s is not alive,please checkout!' % i['udid']) except Exception as e: print('Raise ERROR %s\nThe IP %s device is not alive,please checkout!' % (e, i['udid'])) return devices_list else: raise Exception('ATX-Server has no online device!!! ')
def check_devives(): # 根据method 获取android设备 method = ReadConfig().get_method().strip() if method == 'SERVER': # get ATX-Server Online devices # devices = ATX_Server(ReadConfig().get_server_url()).online_devices() print('Get available online devices from ATX-Server...') devices = get_online_devices( ATX_Server(ReadConfig().get_server_url()).online_devices()) print('\nThere has %s online devices in ATX-Server' % len(devices)) elif method == 'SERVER2': # get atxserver2 Online devices print('Get available online devices from atxserver2...') devices = atxserver2_online_devices( atxserver2( ReadConfig().get_server_url()).present_android_devices()) print('\nThere has %s online devices in atxserver2' % len(devices)) elif method == 'UDID': print('Get available UDID devices %s from atxserver2...' % ReadConfig().get_server_udid()) devices = atxserver2_online_devices( atxserver2(ReadConfig().get_server_url()).present_udid_devices()) print('\nThere has %s available udid devices in atxserver2' % len(devices)) elif method == 'IP': # get devices from config devices list print('Get available IP devices %s from config... ' % ReadConfig().get_devices_ip()) devices = get_devices() print('\nThere has %s devices alive in config IP list' % len(devices)) elif method == 'USB': # get devices connected PC with USB print('Get available USB devices connected on PC... ') devices = connect_devices() print('\nThere has %s USB devices alive ' % len(devices)) else: raise Exception('Config.ini method illegal:method =%s' % method) return devices
def check_devives(): # 根据method 获取android设备 method = ReadConfig().get_method().strip() if method == 'SERVER': # get ATX-Server Online devices # devices = ATX_Server(ReadConfig().get_server_url()).online_devices() print('Checking available online devices from ATX-Server...') devices = get_online_devices() print('\nThere has %s online devices in ATX-Server' % len(devices)) elif method == 'IP': # get devices from config devices list print('Checking available IP devices from config... ') devices = get_devices() print('\nThere has %s devices alive in config IP list' % len(devices)) elif method == 'USB': # get devices connected PC with USB print('Checking available USB devices connected on PC... ') devices = connect_devices() print('\nThere has %s USB devices alive ' % len(devices)) else: raise Exception('Config.ini method illegal:method =%s' % method) return devices
#!/usr/bin/env python # -*- coding: utf-8 -*- import uiautomator2 as u2 import time from Public.BasePage import BasePage from Public.Decorator import * from PageObject import login import unittest from Public.AppAtxLibrary import AppatxLibrary from Public.ReadConfig import ReadConfig apk_url = ReadConfig().get_apk_url() pkg_name = ReadConfig().get_pkg_name() apk_path = ReadConfig().get_apk_path() class 登陆入口检查(unittest.TestCase, BasePage): #本用例包含安装App、启动、初始app、检查正常登陆、退出功能 global a a = AppatxLibrary() @classmethod @setupclass def setUpClass(cls): cls.a = AppatxLibrary() cls.a.clear_app() cls.a.open_app() cls.a.chu_shi() cls.a.login('test1191','z123456z') @testcase
def check_alive(device): if isinstance(device, dict): if 'ip' in device: # atx-server d = u2.connect(device['ip']) if d.agent_alive: d.healthcheck() if d.alive: print('%s is alive' % device['udid']) print('atxagentUrl: %s:7912' % device['ip']) dict_tmp = d.device_info dict_tmp['ip'] = device['ip'] return dict_tmp else: print('%s is not alive' % device['udid']) return None else: print('The device atx_agent %s is not alive,please checkout!' % device['udid']) return None else: # atxserver2 d=u2.connect(device['source']['atxAgentAddress']) if d.agent_alive: d.healthcheck() if d.alive: print('%s is alive' % device['udid']) print('atxagentUrl: %s' % device['source']['atxAgentAddress']) dict_tmp = d.device_info dict_tmp['ip'] = device['source']['atxAgentAddress'] atxserver2(ReadConfig().get_server_url()).using_device(device['udid']) return dict_tmp else: print('%s is not alive' % device['udid']) return None else: print('The device atx_agent %s is not alive,please checkout!' % device['udid']) return None else: d = u2.connect(device) if d.agent_alive: d.healthcheck() if d.alive: if re.match(r"(\d+\.\d+\.\d+\.\d)", device): # config ip dict_tmp = d.device_info dict_tmp['ip'] = device print('%s is alive' % device) else: # usb devices dict_tmp = d.device_info return dict_tmp else: print('%s is not alive' % device) return None else: print('The device atx_agent %s is not alive,please checkout!' % device) return None # if __name__ == '__main__': # devices_ip = get_devices() # devices = connect_devices() # devices = get_online_devices() # print(devices_ip) # # pool = Pool(processes=len(devices_ip)) # tmp_list = [] # for run in devices_ip: # tmp_list.append(pool.apply_async(check_alive, args=(run,))) # # alive_list.append(tmp) # pool.close() # pool.join() # print('All runs done........ ') # print(tmp_list) # for i in tmp_list: # print(i.get()) # print(get_devices()) # print(get_online_devices()) # print(connect_devices())
import unittest from time import sleep from PageObject.login import login_page from Public.Decorator import setupclass, teardownclass from Public.ReadConfig import ReadConfig apk_url = ReadConfig().get_apk_url() pkg_name = ReadConfig().get_pkg_name() apk_path = ReadConfig().get_apk_path1() username = ReadConfig().get_testdata('user_name') pwd = ReadConfig().get_testdata('password') class testLogin(unittest.TestCase, login_page): @classmethod @setupclass def setUpClass(self): self.local_install(apk_path) self.d.app_stop_all() self.d.app_start("com.wujie.siyu") @classmethod @teardownclass def tearDownClass(self): self.d.app_stop("com.wujie.siyu") """测试注册""" def test_01_register(self): self.d.wait_activity('com.yizhuan.cutesound.ui.login.LoginActivity',
return apk else: print('%s \nCannot GET ' % r.url) return False def get_apk_info(path): tmp = apkutils.APK(path).get_manifest() info = {} info['versionCode'] = str(tmp.get('@android:versionCode')) info['versionName'] = str(tmp.get('@android:versionName')) info['package'] = str(tmp.get('@package')) return info def get_apk_activity(path): tmp = apkutils.APK(path).get_manifest() data = tmp['application']['activity'] activity_list = [] for activity in data: activity_list.append(activity['@android:name']) return activity_list if __name__ == '__main__': # apk = get_apk(url='http://www1.xiaoying.co/Android/vivavideo/install.html',keyword='XiaoYing_V8') # print(apk['apk_path']) apk = get_apk(url=ReadConfig().get_APP_URL(), keyword=ReadConfig().get_APP_URL_KEY('XY')) print(apk)
import unittest from time import sleep import time from PageObject.login import login_page from Public.Decorator import setupclass, teardownclass, testcase, teststep from Public.ReadConfig import ReadConfig # apk_url = ReadConfig().get_apk_url() # pkg_name = ReadConfig().get_pkg_name() # apk_path = ReadConfig().get_apk_path1() username = ReadConfig().get_testdata('user_name') pwd = ReadConfig().get_testdata('password') class testUi(unittest.TestCase, login_page): @classmethod @setupclass def setUpClass(self): # self.local_install(apk_path) self.d.app_stop_all() self.d.app_start("com.vodeapp") @classmethod @teardownclass def tearDownClass(self): self.d.app_stop("com.vodeapp") """测试我的""" @testcase @teststep
def setUpClass(cls): cls.watch_device( "Pretty Sure|Sure|Baik, saya paham.|GET IT!|总是允许|始终允许") cls.test_data = get_test_data(cls.d) cls.test_env = ReadConfig().get_test_env()
# -*- coding: utf-8 -*- # @Time : 2018/6/25 18:59 # @Author : Kay # @Site : # @File : test_01_openapp.py # @Software: PyCharm Community Edition import uiautomator2 as u2 import unittest from Public.Decorator import * from Public.BasePage import BasePage from Public.ReadConfig import ReadConfig from Public.JugementSensorData import JugementSensorData from TestSuit_SenSorData.ExpectResult.OpenApp import OpenApp_Expection event_name = ReadConfig().get_testEvent("打开App") apkpage = ReadConfig().get_pkg_name() apkActivity = ReadConfig().get_pkg_activity() class OpenApp(unittest.TestCase,BasePage): @classmethod @setupclass def setUpClass(cls): cls.set_fastinput_ime() cls.unlock_device() cls.d.app_stop_all() @classmethod @setupclass def tearDownClass(cls):
#!/usr/bin/env python # -*- coding: utf-8 -*- from time import sleep import wda from Public.atxserver2 import atxserver2 from Public.ReadConfig import ReadConfig ios_devices = atxserver2(ReadConfig().get_server_url()).present_ios_devices() if ios_devices: wdaUrl = ios_devices[0]['source']['wdaUrl'] c = wda.Client(wdaUrl) print(c.status()) print(c.healthcheck()) with c.session('com.netease.cloudmusic') as d: sleep(10) print(c.status()) d(label=u"每日推荐").click() d(label=u"返回").click() d(label=u"歌单").click() d(label=u"返回").click() d(label=u"排行榜").click() d(label=u"返回").click()
#!/usr/bin/env python # -*- coding: utf-8 -*- from Public.BasePage import BasePage from Public.Decorator import * import unittest from Public.ReadConfig import ReadConfig from PageObject import creation, camera, login, community from Public.Test_data import * from Public.Log import Log log = Log() pkg_name = ReadConfig().get_pkg_name() class camera_testsuite(unittest.TestCase, BasePage): '''相机相关的测试''' # @classmethod # @setupclass # def setUpClass(cls): # cls.d.app_stop_all() # # @classmethod # @teardownclass # def tearDownClass(cls): # cls.d.app_stop("com.quvideo.xiaoying") # @setup def setUp(self): self.d.app_start(pkg_name)
def setUpClass(cls): cls.test_data = get_test_data(cls.d) cls.PAN = "qwert1423q" cls.CPF = '12649239700' cls.watch_device("Pretty Sure|Sure|Baik, saya paham.") cls.test_env = ReadConfig().get_test_env()
# -*- coding: utf-8 -*- # @Time : 2018/9/25 14:46 # @Author : Kay # @Site : # @File : test_02_WorldPageClick.py # @Software: PyCharm Community Edition import unittest from Public.BasePage import BasePage from Public.JugementSensorData import JugementSensorData from Public.Decorator import * from PageObject.KkmhApp.WorldPage import * from PageObject.KkmhApp.SearchPage import * from Public.ReadConfig import ReadConfig from TestSuit_SenSorData.ExpectResult.WorldPageClick import WorldClickExpection event_name = ReadConfig().get_testEvent("世界页点击分布") apkName = ReadConfig().get_pkg_name() distinct_id = ReadConfig().get_testUserID() apkActivity = ReadConfig().get_pkg_activity() Expection = WorldClickExpection() class WorldPageClick(unittest.TestCase, BasePage): @classmethod @setupclass def setUpClass(cls): cls.set_fastinput_ime() cls.unlock_device() cls.d.app_start(apkName, apkActivity) @classmethod