# 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(): m_cam.save_img("Multi-Media") def Recordvideo(key): global suc_times number = 0 times = int(dicttest_times.get(key.lower(), 0)) if times: logger.debug("Record video 10s " + str(times) + ' Times') # if m_cam.stay_in_camera() and m_cam.Switch_mode(['Video', '']): try: for loop in range(times):
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 logger.info("Trace Total Times " + str(test_times))
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' def switch_wifi(key):
#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
# ****************************************************************************** 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]) logger.debug("Connect devices")
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 = [] Device1 = cfg.getstr("TestDevice", "device1", "common")
#***************************************************************************** # 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):
from selenium import webdriver from selenium.webdriver.firefox.firefox_binary import FirefoxBinary 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.getconfigs import GetConfigs from common.globalparameter import test_plan from common.globalparameter import test_task 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") MDevice = cfg.getstr("TestDevice", "mdevice", "common") SDevice = cfg.getstr("TestDevice", "sdevice", "common") SW_version = cfg.getstr("TestVersion", "maincode", "common") Perso_version = cfg.getstr("TestVersion", "perso", "common") Tester = cfg.getstr("Tester", "tester", "common") modules_name = ["01_Launcher", "03_Network", "04_Wifi", "05_Bluetooth", "06_Settings", "08_Contacts", "09_Messaging", \ "10_Email.py", "11_Chrome&&Browser", "12_Camera", "13_Gallery", "14_Filemanager", "15_SoundRecoder",\ "16_Call", "20_Time", "21_Multimedia"] class TestMTBF(unittest.TestCase):
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()): test_times += int(dicttest_times[TestTime])