import common.navigation_L import common.settings logger = common.common.createlogger("MAIN") logger.debug("Connect devices") mdevice = common.common.connect_device("MDEVICE") # m_brow = common.browser2.Browser(mdevice, "M_BROW") m_cam = common.camera.Camera(mdevice, "M_CAM") m_srec = common.recorder2.Recorder(mdevice, "M_SREC") m_mp3 = common.mix.Music(mdevice, "M_Music") m_nav = common.navigation_L.Navigation(mdevice, "M_MAV") # m_nav = common.navigation_M.Navigation(mdevice, "M_MAV") m_settings = common.settings.Settings(mdevice, 'M_SETTINGS') cfg = GetConfigs("06_multi-media") suc_times = 0 test_times = 0 dicttest_times = cfg.get_test_times() for test_time in dicttest_times: if test_time.upper() in ('VIDEOTIMES', 'PHOTOTIMES', 'RECORDER'): test_times = test_times + int(dicttest_times[test_time]) * 3 else: test_times += int(dicttest_times[test_time]) logger.info('Trace Total Times ' + str(test_times)) testplace = cfg.getstr("TestPlace", "TEST_PLACE", "common") def save_fail_img():
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('05_switch_back_front') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info("------------------Start switch camera font and back")
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('01_take_photo_back') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info("------------------Start check camera for back") @classmethod
import common.filemanager import common.navigation_M logger = common.common.createlogger("MAIN") logger.debug("Connect devices") mdevice = common.common.connect_device("MDEVICE") m_filemanager = common.filemanager.Filemanager(mdevice, "M_FILEMANAGER") m_nav = common.navigation_M.Navigation(mdevice, "M_MAV") # internal_storage_name = 'PHONE' # internal_storage_name = 'Phone storage' internal_storage_name = 'Internal storage' logger.debug("Get some configurations") cfg = GetConfigs("10_filemanager") dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) def OpenCloseFilemanager(key): global suc_times times = int(dicttest_times.get(key.lower(), 0)) if times: logger.debug("Open Close Filemanager Time " + str(times)) for loop in range(times): try:
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('12_camera_filter_front') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info("------------------Start check camera for front")
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('04_take_photo_stereo') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info("------------------Start check camera for stereo")
from common.alarm_time_tct import Alarm from common.alarm_clock_tct import Alarm from common.getconfigs import GetConfigs logger = common.common.createlogger("MAIN") logger.debug("Connect devices") mdevice = common.common.connect_device("MDEVICE") m_cale = common.calendar_google.Calendar(mdevice, "M_CAlE") # m_ala = common.alarm_time_tct.Alarm(mdevice, "M_ALA") m_ala = common.alarm_clock_tct.Alarm(mdevice, "M_ALA") test_times = 0 suc_times = 0 cfg = GetConfigs("05_pim") dicttesttimes = cfg.get_test_times() for test_time in dicttesttimes: test_times += int(dicttesttimes[test_time]) logger.info("Trace Total Times " + str(test_times)) calendar_task_name = [] def save_fail_img(): m_cale.save_img("PIM") def add_alarm(key): global suc_times times = int(dicttesttimes.get(key.lower(), 0)) if times:
from __future__ import division import traceback import common.common from uiautomator import Device from common.settings import Settings from common.getconfigs import GetConfigs logger = common.common.createlogger("MAIN") logger.debug("Connect devices") mdevice = common.common.connect_device("MDEVICE") d1_set = common.settings.Settings(mdevice, "M_SETTINGS") logger.debug("Get some configurations") cfg = GetConfigs("09_settings") NetworkType = cfg.getstr("Default", "NETWORK_TYPE", "common") logger.info("Network Typr is " + NetworkType) SSID = cfg.getstr("Wifi", "wifi_name", "common") PWD = cfg.getstr("Wifi", "wifi_password", "common") dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) # Wifi = u'Wi\u2011Fi' Wifi = 'Wi-Fi'
0] + "\\ResourceFile\\PicComparison\\TestFile\\Contacts_51-100.vcf" FilePathApk = sys.path[ 0] + "\\ResourceFile\\PicComparison\\TestFile\\AutoFillTest.apk" FilePathMusic = sys.path[0] + "\\ResourceFile\\PicComparison\\TestFile\\Music" FilePathPictures = sys.path[ 0] + "\\ResourceFile\\PicComparison\\TestFile\\Pictures" FilePathMessage = sys.path[ 0] + "\\ResourceFile\\PicComparison\\TestFile\\Message" FilePathMovies = sys.path[0] + "\\ResourceFile\\PicComparison\\TestFile\\Movies" logger = common.common.createlogger('MAIN') logger.debug('connect device') mdevice = common.common.connect_device('MDEVICE') m_init = common.initialize.Initialize(mdevice, "M_INITIALIZE") suc_times = 0 cfg = GetConfigs("") email_password = '******' environ = os.environ device_id = environ.get('MDEVICE') logger.debug("Device ID is " + device_id) email_dict = { 'RCN7FAIRVSPRHAGA': '*****@*****.**', 'EIZT75BM8DBQHEUW': '*****@*****.**', 'KNF6KJQWJBL7PBUK': '*****@*****.**', 'CMOF6HRSZSNZ9LI7': '*****@*****.**', 'FEFYDM5TVWOV6D5D': '*****@*****.**', 'CIAAOBPZ5PGIOR5H': '*****@*****.**' } internal_storage_name = 'Internal storage'
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('08_take_video_front') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info("------------------Start check camera video for front")
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('11_camera_filter_back') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() logger.info("------------------Start check camera for back") @classmethod
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('15_camera_mode') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info("------------------Start check camera mode for front")
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('09_take_photo_hdr') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info("------------------Start check camera for HDR")
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('03_take_photo_flash_back') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info("------------------Start check camera flash for back")
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('13_camera_delay_back') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info("------------------Start check camera delay for back")
import traceback import common.common from common.getconfigs import GetConfigs import common.phone import common.chrome import common.navigation_M logger = common.common.createlogger("MAIN") logger.debug("Connect devices") mdevice = common.common.connect_device("MDEVICE") m_phone = common.phone.Phone(mdevice, "M_TEL") m_chrom = common.chrome.chrome(mdevice, "M_BROW") m_nav = common.navigation_M.Navigation(mdevice, "M_MAV") cfg = GetConfigs("07_multi tasking") dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for test_time in dicttest_times: test_times += int(dicttest_times[test_time]) test_times = test_times + 2 logger.info('Trace Total Times ' + str(test_times)) def save_fail_img(): m_nav.save_img("Multi-Tasking") def launch_apps(): app_names = ['Messaging', 'Contacts', 'Settings', 'Camera', 'Files']
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('07_take_video_back') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info("------------------Start check camera video for back") @classmethod
#coding=utf-8 import sys,time import MySQLdb,redis import paramiko from common.common import Common from common.getconfigs import GetConfigs date=time.strftime('%m-%d-%H-%M',time.localtime(time.time())) xlsx_path=sys.path[0]+'\\result\\'+date+'_backup.xlsx' config = GetConfigs() server_name=config.getstr('select_server','server','server') ip=config.getstr(server_name,'ip','server') mysql_port=config.getint(server_name,'mysql_port','server') redis_port=config.getint(server_name,'redis_port','server') #mysql_tables_list=['user_info','file_info','friend_info','local_user_status'] mysql_tables_list=config.getstr('mysql_tables_list','mysql_table_name','restore_table').split(',') #connect Mysql conn = MySQLdb.connect(host=ip,user='******',passwd='qhkj_mysql_987',port=mysql_port,charset='utf8') conn.select_db('backup_database') cur = conn.cursor() def backup(): ssh=None Common.create_xlsx(xlsx_path,mysql_tables_list) for mysql_table_name in mysql_tables_list: redisdb=0
#***************************************************************************** # Title: 03_Email #****************************************************************************** from __future__ import division import random import os import traceback import common.common from common.getconfigs import GetConfigs import common.settings import common.email_tct logger = common.common.createlogger("MAIN") suc_times = 0 cfg = GetConfigs("03_email") address = cfg.getstr("Email", "address", "common") RECEIVERLIST = address.split(",") logger.debug("Connect devices") NetworkType = cfg.getstr("Default", "NETWORK_TYPE", "common") logger.info("Network Type is " + NetworkType) mdevice = common.common.connect_device("MDEVICE") m_mail = common.email_tct.Email(mdevice, "M_EMAIL") m_settings = common.settings.Settings(mdevice, 'M_SETTINGS') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 NetworkType_split = NetworkType.split('/') lenght = len(NetworkType_split) for TestTime in dicttest_times: for i in range(lenght):
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('17_take_photo_face_beauty_front') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info( "------------------Start check face beauty camera for front")
from selenium import webdriver from selenium.webdriver.firefox.firefox_binary import FirefoxBinary from common.getconfigs import GetConfigs from common.log import log from common.create_plan import Create_Plan from common.create_scripts import Create_Scripts from common.create_project import Create_project from common.create_task import Create_task from common.lock_project import Lock_project from common.login_tcloud import Login_tcloud from common.globalparameter import test_plan from common.globalparameter import test_task from selenium.webdriver.common.by import By cfg = GetConfigs() username = cfg.getstr("Login", "username", "common") password = cfg.getstr("Login", "password", "common") test_project = cfg.getstr("TestProject", "test_project", "common") vpm = cfg.getstr("TestProject", "vpm", "common") PC_name = cfg.getstr("TestPC", "pc_name", "common") SW_version = cfg.getstr("TestVersion", "maincode", "common") Perso_version = cfg.getstr("TestVersion", "perso", "common") Tester = cfg.getstr("Tester", "tester", "common") scripts_name = [ # "00_Initialize.py", "01_Telephony.py", "02_Messaging.py", "03_Email.py", "04_Browser.py", "05_PIM.py", \ "06_Multi-Media.py", "07_Multi Tasking.py", "08_Menu_Navigation.py", "09_Settings.py", "10_Filemanager.py"] DeviceID = []
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('16_take_photo_face_beauty_back') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info( "------------------Start check face beauty camera for back")
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('02_take_photo_front') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info("------------------Start check camera for front")
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('14_camera_delay_front') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info("------------------Start check camera delay for front") @classmethod
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('10_take_photo_low_light') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info("------------------Start check camera for low light")
import unittest import os from uiautomator import Device import common.common from common.getconfigs import GetConfigs from common.camera_stress import Camera logger = common.common.createlogger("MAIN") logger.debug("Connect device") mdevice = common.common.connect_device("MDEVICE") m_com = common.common.Common(mdevice, "M_COMMON") m_camera = common.camera_stress.Camera(mdevice, "m_camera") logger.debug('Get some configrations') cfg = GetConfigs('06_switch_mode') dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 for TestTime in dicttest_times: test_times += int(dicttest_times[TestTime]) logger.info("Trace Total Times " + str(test_times)) class CheckCamera(unittest.TestCase): @classmethod def setUpClass(cls): m_com.registerWatchers() m_com.clear_recent() logger.info("------------------Start switch mode")
# Title: 04_Browser # ****************************************************************************** from __future__ import division from uiautomator import Device import os, sys import math import traceback import random import common.common from common.getconfigs import GetConfigs import common.browser import common.settings logger = common.common.createlogger("MAIN") logger.debug("Get some configurations") cfg = GetConfigs("04_browser") testplace = cfg.getstr("TestPlace", "TEST_PLACE", "common") NetworkType = cfg.getstr("Default", "NETWORK_TYPE", "common") logger.info("Test Network Type is " + NetworkType) dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 NetworkType_split = NetworkType.split('/') lenght = len(NetworkType_split) for TestTime in dicttest_times: for i in range(lenght): if TestTime.upper().find(NetworkType_split[i].upper()) > -1: test_times += int(dicttest_times[TestTime])
from __future__ import division from uiautomator import Device import traceback import os import common.common from common.getconfigs import GetConfigs import common.settings import common.message2 logger = common.common.createlogger("MAIN") logger.debug("Connect devices") mdevice = common.common.connect_device("MDEVICE") m_msg = common.message2.Message(mdevice, "M_MESSAGE") m_settings = common.settings.Settings(mdevice, "M_SETTINGS") cfg = GetConfigs("02_messaging") SEND_TO_NUMBER = cfg.getstr("Message", "msg_receive_num", "common") NetworkType = cfg.getstr("Default", "NETWORK_TYPE", "common") logger.info("Network Type is " + NetworkType) dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 NetworkType_split = NetworkType.split('/') lenght = len(NetworkType_split) for TestTime in dicttest_times: for i in range(lenght): if TestTime.upper().find(NetworkType_split[i].upper()) > -1: test_times += int(dicttest_times[TestTime]) if TestTime.upper() == "OPENTIMES": test_times = test_times + int(dicttest_times[TestTime]) * 4
import os import common.common from common.getconfigs import GetConfigs import common.phone import common.contact import common.settings logger = common.common.createlogger("MAIN") logger.debug("Connect devices") mdevice = common.common.connect_device("MDEVICE") m_phone = common.phone.Phone(mdevice, "M_TEL") m_contacts = common.contact.Contact(mdevice, "M_CONTACT") m_settings = common.settings.Settings(mdevice, "M_SETTINGS") cfg = GetConfigs("01_telephony") NetworkType = cfg.getstr("Default", "NETWORK_TYPE", "common") logger.info("Network Type is " + NetworkType) dicttest_times = cfg.get_test_times() test_times = 0 suc_times = 0 NetworkType_split = NetworkType.split('/') lenght = len(NetworkType_split) for TestTime in dicttest_times: for i in range(lenght): if TestTime.upper().find(NetworkType_split[i].upper()) > -1: test_times += int(dicttest_times[TestTime]) if (TestTime.upper() == 'DelContactsTimes'.upper()) or ( TestTime.upper() == 'AddContactsTimes'.upper()) or ( TestTime.upper() == 'CallformContactsTimes'.upper()) or ( TestTime.upper() == 'CallformCallLogTimes'.upper()):