class TestResultOper(): '''处理测试结果''' def __init__(self): self.ora = MyOracle() def updateActualResult(self, result, sceneCode): ''' 根据sceneCode更新案例执行实际结果 :param result:实际结果 :param sceneCode: :return: ''' Assert().assertTrue(len(result) > 0, msg='result不能为空!') Assert().assertTrue(len(sceneCode) > 0, msg='sceneCode不能为空!') valueDic = {'ACTUAL_RESULT': result} condDic = {'SCENE_CODE': sceneCode} self.ora.updateData(route='cen1', dt_update=valueDic, dt_condition=condDic, table='AUTOTEST_EXEC_PLAN') def updateOrderId(self, submitMsg, sceneCode): ''' 根据sceneCode更新案例执行实际结果 :param orderId:案例执行成功后将orderId处理后写入 :param sceneCode: :return: ''' Assert().assertTrue(len(submitMsg) > 0, msg='submitMsg不能为空!') Assert().assertTrue(len(sceneCode) > 0, msg='sceneCode不能为空!') Assert().assertIn('成功', submitMsg, msg='业务受理失败,不能写入OrderId') valueDic = {'ORDER_ID': getDigitFromStr(submitMsg)} condDic = {'SCENE_CODE': sceneCode} self.ora.updateData(route='cen1', dt_update=valueDic, dt_condition=condDic, table='AUTOTEST_EXEC_PLAN') def updateRuleCheckInfo(self, msg, sceneCode): ''' 根据sceneCode更新案例执行实际结果 :param orderId:案例执行成功后将orderId处理后写入 :param sceneCode: :return: ''' Assert().assertTrue(len(msg) > 0, msg='ruleMsg不能为空!') Assert().assertTrue(len(sceneCode) > 0, msg='sceneCode不能为空!') valueDic = {'RULE_CHECK_INFO': msg} condDic = {'SCENE_CODE': sceneCode} self.ora.updateData(route='cen1', dt_update=valueDic, dt_condition=condDic, table='AUTOTEST_EXEC_PLAN')
import time import requests import json from Base import HTMLTestRunnerCNNew from Base import ReadConfig from Base.Mylog import LogManager from Base.OperExcel import get_exceldata, write_xlsBycolName_append, write_dict_xls from Base.OracleOper import MyOracle from Common.function import dict_get from TestCases.suite import mySuitePrefixAdd logger = LogManager('ChgUserPwd').get_logger_and_add_handlers( 1, log_path=ReadConfig.log_path, log_filename=time.strftime("%Y-%m-%d") + '.log') ora = MyOracle() #取10个测试号码修改密码为108109: sql = "select rownum No ,'' flowid , '' result_info ,t.access_num , \ t.password Old_pwd,uop_file4.f_csb_encrypt('108109',t.subscriber_ins_id) new_pwd ,t.subscriber_ins_id \ from uop_file4.um_subscriber t \ where t.access_num like '1880872%' and t.mgmt_district = '0872' \ and t.remove_tag = '0' and rownum <=100" paras = ora.select(sql) logger.info('测试准备数据:{}'.format(paras)) now = time.strftime("%Y%m%d%H%M%S") file = ReadConfig.get_data_path() + 'ApiTest_ChgUserPwd_%s.xlsx' % now #生成xls表,方便后续写入测试结果 write_dict_xls(inputData=paras, sheetName='用户密码修改', outPutFile=file) logger.info('写入测试数据到xls.....')
import os, time import xlrd from Base.OperExcel import write_dict_xls, getColumnIndex, getRowIndex from Base.Mylog import LogManager from Base.OracleOper import MyOracle from Base import ReadConfig from Common.function import convertParatoList logger = LogManager('TestDataMgnt').get_logger_and_add_handlers( 1, is_add_stream_handler=True, log_path=ReadConfig.log_path, log_filename=time.strftime("%Y-%m-%d") + '.log') os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8' rc = ReadConfig.ReadConfig("ngboss_config.ini") ora = MyOracle() class TestDataExcel(): '''处理TestData 表格''' def __init__(self): # self.file = ReadConfig.data_path + 'UITest_TestData_%s.xls' %(time.strftime(("%Y%m%d"))) self.file = ReadConfig.data_path + 'UITest_TestData.xls' def get_testDataFile(self): filepath = self.file return filepath def get_TestData(self, FuncCode, index=0): ''' 根据FuncCode获取测试数据,并统一转换成List数据结构,方便DDT数据驱动
import requests import json from Base import HTMLTestRunnerCNNew from Base import ReadConfig from Base.Mylog import LogManager from Base.OperExcel import get_exceldata, write_xlsBycolName_append, write_dict_xls from Base.OracleOper import MyOracle from Common.function import dict_get, join_dictlists from TestCases.suite import mySuitePrefixAdd logger = LogManager('ChgMainAndShare').get_logger_and_add_handlers( 1, is_add_stream_handler=True, log_path=ReadConfig.log_path, log_filename=time.strftime("%Y-%m-%d") + '.log') ora = MyOracle() #分别取5个主卡号码和副卡号码: '''主卡号码''' sql_accessNum = "select rownum No ,'' flowid , '' result_info ,t.access_num , to_char(t.subscriber_ins_id) subscriber_ins_id \ from uop_file4.um_subscriber t \ where t.access_num like '1830872%' and t.mgmt_district = '0872' \ and t.remove_tag = '0' and rownum <=5" '''副卡号码''' sql_ViceaccessNum = "select t.access_num VICE_ACCESS_NUM , to_char(t.subscriber_ins_id) rel_subscriber_insid \ from uop_file4.um_subscriber t \ where t.access_num like '135%' and t.mgmt_district = '0872' \ and t.remove_tag = '0' and rownum <=5" AccessNumList = ora.select(sql_accessNum) ViceNumList = ora.select(sql_ViceaccessNum) paras = join_dictlists(AccessNumList, ViceNumList)
def __init__(self): self.ora = MyOracle()