class App: logger = Logger() configuration = Configuration() def __init__(self): pass def run(self): pass
def __init__(self, plist_path): """ :param plist_path: plist 文件路径 """ super().__init__(plist_path) self.app_config = Configuration( self.content, conf=EnvEnum.CONFIGURATION.value) self.export_plist_path = f'{EnvEnum.SCRIPT_PATH.value}/plist/{self.app_config.method}.plist' self.icon_url = f'{EnvEnum.SCRIPT_URL.value}{self.app_config.icon_path}'
def __init__(self, browser): """ 初始化测试浏览器. """ self.__driver = browser # 创建配置文件实例 self.__config = Configuration() # 获取框架主路径信息 self.__home_path = os.path.dirname(os.path.dirname(__file__))
def __init__(self): # 创建配置文件实例 config = Configuration() # 获取框架主路径信息 self.__home_path = os.path.dirname(os.path.dirname(__file__)) # 读取配置文件中的测试用例路径和测试用例执行规则 self.__test_path = config.getConfigValue("testCaseSuite", "test_path") logger.info("测试用例路径为: %s." % self.__test_path) self.__test_rule = config.getConfigValue("testCaseSuite", "test_rule") logger.info("测试用例执行规则为: %s." % self.__test_rule)
def __init__(self): # 创建配置文件实例 self.__config = Configuration() # 从配置文件获取数据库相关信息 self.__host = self.__config.getConfigValue("mysqlInfo", "host") self.__user = self.__config.getConfigValue("mysqlInfo", "user") self.__password = self.__config.getConfigValue("mysqlInfo", "password") self.__database = self.__config.getConfigValue("mysqlInfo", "database") # 连接数据库,获取操作游标 self.__db = self.__dbConnect() self.__cursor = self.__db.cursor()
def __init__(self): """ 初始化发送邮件配置,从配置文件中,获取发邮件的基本信息:发件服务器,端口,账号,密码,收件人. """ # 创建配置文件实例 config = Configuration() # 获取框架主路径信息 self.__home_path = os.path.dirname(os.path.dirname(__file__)) # 读取发件服务器,端口,账号,密码,收件人 self.__smtpserver = config.getConfigValue("sendMailInfo", "smtp_server") self.__port = config.getConfigValue("sendMailInfo", "port") self.__sender = config.getConfigValue("sendMailInfo", "sender") self.__psw = config.getConfigValue("sendMailInfo", "password") self.__receivers = config.getConfigValue( "sendMailInfo", "receivers").split(";") # 得到收件人列表
__author__ = "sunxr" __version__ = "V1.2" # 集成测试用例执行和发送邮件功能 def executeCompatibilityTestcasesAndSendMail(thread_browser_type): """ 集成测试用例执行和发送邮件功能. :param thread_browser_type: 浏览器类型 """ TestCaseSuite().executeCompatibilityTestCases(thread_browser_type) SendMail().sendTestReport() # 实例化配置文件 config = Configuration() # 获取浏览器类型数量 browser_types = config.getConfigOptions(section="browserType") browser_counts = len(browser_types) # 获取浏览器具体类型 browsers = list() for browser_type in browser_types: browser = config.getConfigValue(section="browserType", option=browser_type) browsers.append(browser) # 利用多线程启动所有浏览器执行用例 threads = list()