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.....')

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 = {
#取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("构建登录请求.....")
        logger.info("登录地址:" + rc.get_interface_url("url_login"))
Exemplo n.º 3
0
        self.assertNotIn('校验失败',ruleMsg) # 校验通过才继续执行
        logger.info('开始设置主号家庭短号服务')
        test.screen_step('进入亲情网办理菜单')
        test.set_mainCard(AccessNum)
        logger.info('新增家庭成员并设置家庭短号服务')
        test.set_mutiCard(mutiAccessNumList)
        time.sleep(2)
        test.find_element_click(Btn_commit)
        time.sleep(15)
        submitMsg = PageAssert(self.driver).assert_submitAfter(file=file,row=row)
        logger.info('业务受理信息:{}'.format(submitMsg))
        test.screen_step('点击提交,受理信息:{}'.format(submitMsg))
        test.save_docreport(title)
        time.sleep(3)
        self.assertIn('业务受理成功',submitMsg)

    def tearDown(self):
        print('测试结束,关闭浏览器器!')
        self.driver.close()

if __name__ == '__main__':
    report_title = u'亲情网业务办理自动化测试报告'
    desc = u'亲情网业务办理测试详情:'
    nowtime = time.strftime("%Y%m%d%H%M%S")
    logger.info("开始执行testSuite......")
    print("开始执行testSuite......")
    with open(ReadConfig.get_reportPath() + report_title + nowtime + ".html", 'wb') as fp:
        runner = HTMLTestRunnerCNNew.HTMLTestRunner(stream=fp, title=report_title, description=desc,verbosity=2)
        runner.run(mySuitePrefixAdd(FamilyNetTest,"test_acceptMultiOffer"))

Exemplo n.º 4
0
from Base.OperExcel import write_xlsBycolName_append
from Base.Mylog import LogManager
from Check.PageCheck import PageAssert
from TestCases.suite import mySuitePrefixAdd
from Common.TestDataMgnt import get_TestData,get_testDataFile

os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'
rc = ReadConfig.ReadConfig("ngboss_config.ini")
logger = LogManager('OfferOperTest').get_logger_and_add_handlers(1, log_path=ReadConfig.log_path, log_filename=time.strftime("%Y-%m-%d")+'.log' )

# file = ReadConfig.data_path + 'UITest_OfferChg.xls'
# offers = get_exceldata(file,0)
file = get_TestData('OfferOperTest')['filename']
offers = get_TestData('OfferOperTest')['params']
row = get_TestData('OfferOperTest')['FuncRow']
logger.info('测试案例执行数据准备:{}'.format(offers))

@ddt.ddt
class OfferOperTest(unittest.TestCase):
    """个人业务-商品订购测试"""
    def setUp(self):
        self.driver = webdriver.Chrome()
        self.driver.get(rc.get_ngboss('url'))     #这里可以切换环境,去ngboss_config.ini配置
        self.driver.maximize_window()
        self.driver.implicitly_wait(20)    #暂时设置40s,隐式等待

    @ddt.data(*offers)
    def test_chgMainOffer(self,dic):
        """商品主套餐变更"""
        logger.info("开始参数化......")
        accessNum = str(dic.get('ACCESS_NUM'))
Exemplo n.º 5
0
# ora = MyOracle()
#取停开机业务受理号码
'''
:param busiCode: 传入停开机业务受理类型
126 局方开机,136 局方停机
132 挂失
131 报停,133 报开
138 特殊停机
496 担保开机 497 紧急开机
'''
params = []
file = get_TestData('SubscriberStop')['filename']
# 报停
paras_stop = get_TestData(FuncCode='SubscriberStop')['params']
logger.info('停开机业务受理-报停测试准备数据:{}'.format(paras_stop))
params.extend(paras_stop)
# 合帐
paras_open = get_TestData(FuncCode='SubscriberOpen')['params']
logger.info('停开机业务受理-报停测试准备数据:{}'.format(paras_open))
params.extend(paras_open)
print('======合并后=====', params)

# sql_StopMobile = "select rownum No ,'' result_info ,'' flowid,T.ACCESS_NUM,'131' BUSI_CODE from uop_file4.um_subscriber t ,uop_file4.um_prod_sta a \
# where t.remove_tag = '0' and  a.IS_MAIN ='1' and a.PROD_STATUS='0' and a.EXPIRE_DATE> sysdate \
# and  a.PARTITION_ID = t.partition_id and a.SUBSCRIBER_INS_ID = t.subscriber_ins_id \
# and  t.access_num LIKE '187%'  and t.mgmt_district ='0872' \
# and rownum <=3 "
#
# sql_OpenMobile = "select rownum No ,'' result_info ,'' flowid,T.ACCESS_NUM,'133' BUSI_CODE,a.PROD_STATUS from uop_file4.um_subscriber t ,uop_file4.um_prod_sta a \
#     where t.remove_tag = '0' and  a.IS_MAIN ='1' and a.PROD_STATUS = '1' and a.EXPIRE_DATE> sysdate \
Exemplo n.º 6
0
# sql_merg =  "select rownum No ,'' result_info ,'' flowid,T.ACCESS_NUM ,'2' Oper_code from uop_file4.um_subscriber t ,uop_file4.um_prod_sta a \
# where t.remove_tag = '0' and  a.IS_MAIN ='1' and a.PROD_STATUS='0' and a.EXPIRE_DATE> sysdate \
# and  a.PARTITION_ID = t.partition_id and a.SUBSCRIBER_INS_ID = t.subscriber_ins_id \
# and  t.access_num LIKE '187%'  and t.mgmt_district ='0872' \
# and rownum <=3 "

# paras_sep= ora.select(sql_sep) #  分账
# paras_merg= ora.select(sql_merg) #  分账
#
# paras = paras_sep
# # paras = paras_merg
file = get_testDataFile()
params = []
# 分账
paras_sep = get_TestData(FuncCode='ChgPayRelaSeprate')['params']
logger.info('普通付费关系变更-分账测试准备数据:{}'.format(paras_sep))
params.extend(paras_sep)
# 合帐
paras_merge = get_TestData(FuncCode='ChgPayRelaMerge')['params']
logger.info('普通付费关系变更-合帐测试准备数据:{}'.format(paras_merge))
params.extend(paras_merge)
params = params
print('======合并后=====', params)
# now = time.strftime("%Y%m%d%H%M%S")
# file = ReadConfig.get_data_path() + 'UITest_ChgPayRelaTest_%s.xls' % now
# #生成xls表,方便后续写入测试结果
# write_dict_xls(inputData=paras, sheetName='普通付费关系变更', outPutFile=file)
# logger.info('写入测试数据到xls.....')

@ddt.ddt
class ChgPayRelaTest(unittest.TestCase):
Exemplo n.º 7
0
from Base.Mylog import LogManager
from TestCases.suite import mySuitePrefixAdd
# from Check.PageCheck import PageAssert
from Check.DataCheck import DataCheck
# from Data.DataMgnt.TestDataMgnt import TestDataExcel
from Data.DataMgnt.DataOper import DataOper
from Data.DataMgnt.TestResult import TestResultOper

os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'
rc = ReadConfig.ReadConfig("ngboss_config.ini")
logger = LogManager('CrtUsVpmnTest').get_logger_and_add_handlers(1, log_path=ReadConfig.log_path, log_filename=time.strftime("%Y-%m-%d")+'.log' )

# params = TestDataExcel().get_TestData('CrtUsVPMN')['params']
# file = TestDataExcel().get_TestData('CrtUsVPMN')['filename']
params = DataOper().getCasePara('CrtUsVPMN')
logger.info('=========================')
logger.info(params)

@ddt.ddt
class CrtUsVpmnTest(unittest.TestCase):
    '''集团VPMN商品订购'''
    # @classmethod
    def setUp(self):
        self.driver = webdriver.Chrome()
        self.driver.get(rc.get_ngboss('url'))     #这里可以切换环境,去ngboss_config.ini配置
        self.driver.maximize_window()

    @ddt.data(*params)
    def testCrtUsVpmn(self,dic):
        '''集团VPMN商品订购'''
        logger.info("开始参数化......")
Exemplo n.º 8
0
from Check.PageCheck import PageAssert
from TestCases.suite import mySuitePrefixAdd
from Common.TestDataMgnt import get_TestData, get_testDataFile

os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'
rc = ReadConfig.ReadConfig("ngboss_config.ini")
logger = LogManager('ChgOfferTest').get_logger_and_add_handlers(
    1,
    log_path=ReadConfig.log_path,
    log_filename=time.strftime("%Y-%m-%d") + '.log')

file = ReadConfig.data_path + 'UITest_ChgOffer.xls'
offers = get_exceldata(file, 0)
svc = get_exceldata(file, 1)
active = get_exceldata(file, 2)
logger.info('主套餐变更测试案例执行数据准备:{}'.format(offers))
logger.info('服务变更案例执行数据准备:{}'.format(svc))
logger.info('营销活动受理案例执行数据准备:{}'.format(svc))


@ddt.ddt
class ChgOfferTest(unittest.TestCase):
    """个人业务-商品订购测试"""
    @classmethod
    def setUp(self):
        self.driver = webdriver.Chrome()
        self.driver.get(rc.get_ngboss('url'))  #这里可以切换环境,去ngboss_config.ini配置
        self.driver.maximize_window()

    @ddt.data(*offers)
    def test_chgMainOffer(self, dic):