def setUp(self): """ :return: """ self.log = MyLog.get_log() self.logger = self.log.get_logger()
def setUp(self): """ :return: """ print "测试接口:", self.case_describe self.log = MyLog.get_log() self.logger = self.log.get_logger()
def setUp(self): """ :return: """ time.sleep(3) self.log = MyLog.get_log() self.logger = self.log.get_logger()
def setUp(self): """ :return: """ self.log = MyLog.get_log() self.logger = self.log.get_logger() self.login_token = businessCommon.login()
def readsheet(self, sheet_name): """ :param table_name: sheet表名,若table_name == None,则读取所有table中的数据 :return: 返回list[ {'id': 1.0, 'tags': '位置信息', 'name': '获取ip信息接口测试用例-1', 'method': 'get', 'url': 'http://ip.taobao.com/service/getIpInfo.php', 'headers': "{'Host':'ip.taobao.com'}", 'body': "{'ip':'63.223.108.4'}", 'type': 'json', 'return_status_code': '', 'return_text': ''}, {'id': 2.0, 'tags': '位置信息', 'name': '获取ip信息接口测试用例-2', 'method': 'get', 'url': 'http://ip.taobao.com/service/getIpInfo.php', 'headers': "{'Host':'ip.taobao.com'}", 'body': "{'ip':'127.0.0.1'}", 'type': 'json', 'return_status_code': '', 'return_text': ''} ] """ interfaces_list = [] try: if sheet_name is not None: sheet = self.xl.sheet_by_name(sheet_name) # 获取总列数 rows = sheet.nrows if rows >= 2: # 获取第一行数据,作为字典Key值 keys_list = sheet.row_values(0) for i in range(rows): if i >= 1: parmDict = dict(zip(keys_list, sheet.row_values(i))) interfaces_list.append(parmDict) result = { 'code': '0000', 'message': '执行批量excel查询表%s操作成功' % sheet_name, 'data': interfaces_list } return result else: print('表名为%s数据为空!' % sheet_name) result = { 'code': '0000', 'message': '执行批量excel查询操作失败,表名为%s数据为空' % sheet_name, 'data': [] } return result except xlrd.biffh.XLRDError as e: print('没有名称为%s的sheet' % sheet_name) MyLog.error('没有名称为%s的sheet' % sheet_name) result = { 'code': '9999', 'message': '执行批量excel查询操作失败,没有名称为%s的sheet' % sheet_name, 'data': [] } return result
def setUp(self): """ :return: """ self.log = MyLog.get_log() self.logger = self.log.get_logger() print("测试开始前准备====================>>>>") print("测试用例名为:" + self.case_name)
def __init__(self): global log, logger, resultPath, on_off log = MyLog.get_log() logger = log.get_logger() resultPath = log.get_report_path() self.caseListFile = os.path.join(readConfig.proDir,'caselist.txt') self.caseFile = os.path.join(readConfig.proDir,'test_case') self.caseList = []
def setUp(self): """ :return: """ self.log = MyLog.get_log() self.logger = self.log.get_logger() print("开始测试用例" + self.case_name)
def insert_data(self, condition, params): """ 定义表中插入操作 :param condition: insert 语句 :param params:数据,列表形式[('3','Tom','1 year 1 class','6'),('3','Jack','2 year 1 class','7')] :return:字典形式的批量插入数据结果 """ try: results = self.cur.executemany(condition, params) # 返回插入的数据条数 self.conn.commit() result = {'code': '0000', 'message': '执行批量插入操作成功', 'data': results} except Exception as e: self.conn.rollback() # 执行回滚操作 result = {'code': '9999', 'message': '执行批量插入操作异常', 'data': []} # print("数据库错误| Mysql Error %d: %s" % (e.args[0], e.args[1])) MyLog.error(e) return result
def setUp(self): """ :return: """ self.log = MyLog.get_log() self.logger = self.log.get_logger() print(self.case_name + "测试开始前准备")
def setUp(self): """ :return: """ self.log = Log.get_log() self.logger = self.log.get_logger() self.logger.info(self.case_name + "_ready")
def setUp(self): """ before test :return: """ self.log = Log.get_log() self.logger = self.log.get_logger() self.log.build_start_line(self.case_name)
def setUp(self): """ :return: """ self.log = MyLog.get_log() self.logger = self.log.get_logger() print self.case_describe + u"测试开始前准备"
def __init__(self): self.timeout = 8.0 self.log = MyLog.get_log() self.url = None self.method = None self.params = {} self.header = {} self.data = {}
class orderProcess(unittest.TestCase): def setUp(self): #self.log = Log.Log("OrderList") self.log = MyLog("orderProcess").get_log() #self.driver = webdriver.Firefox() self.log.info("开始测试订单流程") #self.driver.implicitly_wait(30) # 隐性等待时间为30秒 #self.base_url = "https://www.baidu.com" def test_orderStatusChange(self): """测试获取订单状态变化""" self.log.info("开始测试获取订单列表信息") self.log.info("测试成功") def test_OrderFullProcess(self): """测试订单总流程""" self.log.info("开始测试订单总流程") self.log.info("测试成功")
def setUp(self): """ :return: """ self.log = MyLog.get_log() self.logger = self.log.get_logger() sql = "UPDATE ft_orders SET STATUS = '0' WHERE id = '8320';" configDB.MyDB().zhiyu_run_sql(sql)
def setUp(self): """ :return: """ self.log = MyLog.get_log() self.logger = self.log.get_logger() sql1 = "UPDATE fy_house SET STATUS = '2' WHERE id = '1636559';" configDB.MyDB().zhiyu_run_sql(sql1)
def setUp(self): """ :return: """ self.log = MyLog.get_log() self.logger = self.log.get_logger() sql = "UPDATE ft_rent_reside SET STATUS = '-1' WHERE user_id = '566';" configDB.MyDB().zhiyu_run_sql(sql)
class MemberLevelInfo(unittest.TestCase): def setUp(self): #self.log = Log.Log("MemberLevelInfo") self.log = MyLog("MemberLevelInfo").get_log() #self.driver = webdriver.Firefox() self.log.info("开始测试获取会员等级信息") #self.driver.implicitly_wait(30) # 隐性等待时间为30秒 #self.base_url = "https://www.baidu.com" def test_getMemberLevelInfo(self): time.sleep(3) self.log.info("开始测试获取会有等级信息") self.log.info("测试成功") def test_changeMemberLevelInfo(self): self.log.info("开始测试更改会有等级信息") self.log.info("测试成功")
def setUp(self): """ :return: """ self.log = MyLog.get_log() self.logger = self.log.get_logger() print("测试开始前准备====================>>>>") testSendVerifyCode.send_verify_code(self.mobile) print("测试用例名为:" + self.case_name)
class supplierInfo(unittest.TestCase): def setUp(self): #self.log = Log.Log("supplierInfo") self.log = MyLog("supplierInfo").get_log() #self.driver = webdriver.Firefox() self.log.info("开始测试获取供应商信息") #self.driver.implicitly_wait(30) # 隐性等待时间为30秒 #elf.base_url = "https://www.baidu.com" def test_getSupplierInfo(self): """获取供应商信息""" self.log.info("开始测试获取供应商信息") self.log.info("测试成功") def test_DeleteSupplierInfo(self): """删除供应商信息""" self.log.info("开始测试删除供应商信息") self.log.info("测试成功")
class productCategory(unittest.TestCase): def setUp(self): #self.log = Log.Log("productCategory") self.log = MyLog("productCategory").get_log() #self.driver = webdriver.Firefox() self.log.info("开始测试获取商品类型信息") #self.driver.implicitly_wait(30) # 隐性等待时间为30秒 #self.base_url = "https://www.baidu.com" def test_getProductCategory(self): """获取商品种类""" self.log.info("开始测试获取商品种类信息") self.log.info("测试成功") def test_productCategoryUpdate(self): """更新商品种类""" self.log.info("开始测试更新商品种类信息") self.log.info("测试成功")
def __init__(self): global log, logger, resultPath log = Log.get_log() logger = log.get_logger() resultPath = log.get_report_path() # on_off = localReadConfig.get_email("on_off") self.caseListFile = os.path.join(readCongfig.proDir, "caselist.txt") self.caseFile = os.path.join(readCongfig.proDir, "testcase") self.caselist = []
def setUp(self): """ :return: """ print "测试接口:", self.case_describe time.sleep(60) # 因为会报获取验证码太频繁的错误,所以等待10秒 self.log = MyLog.get_log() self.logger = self.log.get_logger()
def setUp(self): """ :return: """ self.log = MyLog.get_log() self.logger = self.log.get_logger() sql = "UPDATE ft_bill_list SET orders_id = 0 WHERE id = 23;" configDB.MyDB().zhiyu_run_sql(sql)
def __http_post(self, interface_url, headerdata, interface_param): """ :param interface_url: 接口地址 :param headerdata: 请求头文件 :param interface_param: 接口请求参数 :return: 字典形式结果 """ try: if interface_url != '': temp_interface_param = self.__new__param(interface_param) if headerdata.get('Content-Type') == 'application/x-www-form-urlencoded': response = requests.post(url=interface_url, headers=headerdata, data=temp_interface_param, verify=False, timeout=10) if headerdata.get('Content-Type') == 'application/json': response = requests.post(url=interface_url, headers=headerdata, json=temp_interface_param, verify=False, timeout=10) if headerdata.get('Content-Type') == 'multipart/form-data': # files = {'file': open('upload.txt', 'rb')} response = requests.post(url=interface_url, headers=headerdata, files=temp_interface_param, verify=False, timeout=10) if response.status_code == 200: response_time = response.elapsed.microseconds / 1000 # 发起请求和响应到达的时间,单位ms result = {'code': '0000', 'message': '成功', 'data': response.text, 'response_time': response_time} else: result = {'code': '2004', 'message': '接口返回状态错误', 'data': []} elif interface_url == '': result = {'code': '2002', 'message': '接口地址参数为空', 'data': []} else: result = {'code': '2003', 'message': '接口地址错误', 'data': []} except Exception as e: result = {'code': '9999', 'message': '系统异常', 'data': []} MyLog.error(e) return result
def setUp(self): """ :return: """ print "测试接口:", self.case_describe self.log = MyLog.get_log() self.logger = self.log.get_logger() sql = "UPDATE coupon_lists SET used_status = 0 WHERE id = 29;" configDB.MyDB().zhiyu_run_sql(sql)
class productInfo(unittest.TestCase): def setUp(self): #self.log = Log("productInfo") self.log = MyLog("productCategory").get_log() #self.driver = webdriver.Firefox() self.log.info("开始测试获取商品信息") #self.driver.implicitly_wait(30) # 隐性等待时间为30秒 #self.base_url = "https://www.baidu.com" def test_getProductInfo(self): """测试获取商品信息""" self.log.info("开始测试获取商品信息") self.log.info("测试成功") def test_getSubProductInfo(self): """测试获取商品子商品""" self.log.info("开始测试获取商品子商品信息") self.log.info("测试成功")
def setUp(self): """ :return: """ print "测试接口:", self.case_describe self.log = MyLog.get_log() self.logger = self.log.get_logger() sql = "UPDATE ft_signing SET STATUS = '5' WHERE house_id = '1636559';" configDB.MyDB().zhiyu_run_sql(sql)
def setUp(self): """ :return: """ print "测试接口:", self.case_describe self.log = MyLog.get_log() self.logger = self.log.get_logger() sql = "UPDATE fy_decorate SET STATUS = 1 WHERE id =28;" configDB.MyDB().zhiyu_run_sql(sql)
def __init__(self): self.log = Log.get_log() self.logger = self.log.get_logger() self.db = None self.cursor = None