Ejemplo n.º 1
0
 def create_testDataFile(self, paras, filename):
     '''自动生成测试数据file,返回完整的dataFile路径'''
     file = filename
     write_dict_xls(inputData=paras,
                    sheetName='AutoTestData',
                    outPutFile=file)
     logger.info('写入测试数据到xls.....')
     return file
    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.....')

rc = ReadConfig.ReadConfig("ngboss_config.ini")
h = {
    'User-Agent':
    'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.162 Safari/537.36',
    "Connection": "keep - alive",
    "Referer": rc.get_ngboss('url')
}

lo_param = {
    "LOGIN_MODE": "BOSS",
    "STAFF_ID": "TESTKM13",
    "IS_XACTIVE": "false",
    "BROWSER_VERSION": "IE-11",
Ejemplo n.º 3
0
#取20个未实名制的测试号码客户信息:
sql = "SELECT rownum No ,t.access_num ,to_char(t.subscriber_ins_id) subscriber_ins_id , \
      to_char(a.iden_id) iden_id,'' NEW_IDENID ,a.iden_type_id,a.iden_nr,b.party_name,\
      to_char(t.cust_id) cust_id ,'' flowid , '' result_info  ,'' NEWCUSTNAME \
     FROM  uop_file4.um_subscriber T ,uop_cp.cb_identification a,uop_cp.cb_party b  \
      where t.remove_tag = '0' and t.access_num LIKE '1880872%' and t.mgmt_district = '0872'\
     and a.party_id = t.cust_id \
     and a.party_id = b.party_id \
     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_ModfiyRealChkInfo_%s.xls' % now
#生成xls表,方便后续写入测试结果
write_dict_xls(inputData=paras, sheetName='实名制登记', outPutFile=file)
logger.info('写入测试数据到xls.....')

rc = ReadConfig.ReadConfig("ngboss_config.ini")
h = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.162 Safari/537.36',
    "Connection": "keep - alive",
    "Referer": rc.get_ngboss('url')
}

lo_param = {"LOGIN_MODE": "BOSS", "STAFF_ID": "TESTKM13", "IS_XACTIVE": "false", "BROWSER_VERSION": "IE-11",
        "PASSWORD": "******", "LOGIN_FLAG": "1"}

@ddt.ddt
class ModfiyRealChkInfo(unittest.TestCase):
    @classmethod
ora = MyOracle()
#取10个测试号码停机操作:busicode =131表示停机操作
'''busiCode: 传入停开机业务受理类型
        126 局方开机,136 局方停机
        132 挂失
        131 报停,133 报开
        138 特殊停机
        496 担保开机 497 紧急开机
'''
sql = "select rownum No ,'' flowid , '' result_info ,t.access_num , '133' busicode \
    from  uop_file4.um_subscriber t \
    where t.access_num in ('18887253716','18887269718','18887269711','18887267264') and t.remove_tag = '0' and rownum <=10"

paras = ora.select(sql)
#生成xls表,方便后续写入测试结果
write_dict_xls(inputData=paras, sheetName='停开机业务受理', outPutFile=file)
logger.info('写入测试数据到xls.....')

##数据驱动paramunittest:
# interfaceList_xls = get_exceldata(ReadConfig.data_path+ 'testdata.xls',0)
# print(interfaceList_xls)
# @paramunittest.parametrized(*interfaceList_xls)


@ddt.ddt
class TestIntf(unittest.TestCase):
    def setUp(self):
        self.file = file
        self.headers = h
        self.session = requests.session()
        logger.info("构建登录请求.....")