def __init__(self): GetLog = Log('basecode') self.getlog = GetLog.log() LOCALCONFIG = operationConfig.CONFIG() pro_dir = operationConfig.RROJECT_DIR excel_dir = os.path.join( pro_dir, LOCALCONFIG.get_config_value('EXCEL', 'excel_file')) self.baseexcel = BaseExcel(excel_dir) self.dict_key_value = eval( LOCALCONFIG.get_config_value('EXCEL', 'excel_case_name')) self.getlog.info('案例key值读取成功为:{0}'.format(self.dict_key_value))
def __init__(self,path): ''' 找到要打开的excel表格,并打开 :param path: ''' self.path=path GetLog = Log('baseExcel') self.getlog = GetLog.log() try: self.workbook=xlrd.open_workbook(self.path) self.getlog.info('打开Excel成功') except BaseException as e: self.getlog.error('打开Excel报错了: %s' % e)
# -*- encoding: utf-8 -*- import os import time import operationConfig from base.log import Log config = operationConfig.CONFIG() report_dir = os.path.join(operationConfig.RROJECT_DIR, 'report\{0}'.format( time.strftime('%Y%m%d'))) #报告地址report下的当前日期下 set_value = config.set_config_value( 'REPORT', 'path', '{0}'.format(report_dir)) #将报告地址写入ini文件中,log记录日志的地址也是该目录下 if not os.path.exists(report_dir): os.mkdir(report_dir) GetLog = Log('Run') getlog = GetLog.log() result = os.system('pytest RunCode --html={0}/report{1}.html'.format( report_dir, time.strftime('%H%M%S'))) getlog.info('报告执行结果查看执行报告')
def __init__(self): Getlog = Log('getCase') self.getlog = Getlog.log() self.basedb = BaseDB() self.getconfig = CONFIG()