def __init__(self): """ 初始化 """ self.dns = cx_Oracle.makedsn(ip, post, service_name) self.conn = None self.cursor = None self.log = MyLog.get_log() self.logger = self.log.get_logger()
def selenium_get_url(self, url): try: self.selenium.get('about:blank') self.selenium.get(str(url)) except Exception as ex: log = MyLog.get_log() logger = log.get_logger() logger.error("Can not open the url:[{}]".format(url)) raise ex return self
def setUp(self): """ 测试用例开始前布置环境,查询车辆的vehicleId,记录日志 :return: """ self.log = MyLog.get_log() self.logger = self.log.get_logger() sql = "SELECT VEHICLE_ID FROM V_VEHICLEINFO WHERE ID_NUMBER LIKE '%s'" % rc.get_vehicle( "ID_NUMBER") vid = orc.executeSQL(sql) self.vehicleIds = orc.get_one(vid)[0] print(self.vehicleIds)
def __init__(self): self.scheme = rc.get_bs("SCHEME") self.ip = rc.get_bs("IP") self.port = rc.get_bs("POST") self.timeout = rc.get_bs("TIMEOUT") self.log = MyLog.get_log() self.logger = self.log.get_logger() self.headers = {} self.data = {} self.url = None self.files = {} self.state = 0
def __init__(self): """ 初始化需要的参数 :return: """ global log, logger, resultPath # log初始化 log = MyLog.get_log() self.logger = log.get_logger() # 定义结果保存路径 self.resultPath = log.get_report_path() # 取得config\caselist.txt文件路径 self.caseListFile = os.path.join(ReadConfig.conf_path, "caselist.txt") # 取得test_case文件路径 self.caseFile = os.path.join(ReadConfig.proDir, "test_case") # 定义一个空列表,用于保存类名 self.caseList = []
def __init__(self): """ 初始化需要的参数 :return: """ global log, logger, resultPath # log初始化 log = MyLog.get_log("[%s]" % os.path.basename(__file__)) self.logger = log.get_logger() # 定义结果保存路径 self.resultPath = log.get_report_path() # 取得test_case文件路径 self.caseFile = os.path.join(TEST_CASE_TOP_DIR, "web_test_case") # 获取配置文件中的EXCEL路径 self.xls_path = TEST_DATA_EXCEL_FILE self.sheet_name = "INDEX" # 定义一个空列表,用于保存类名 self.caseList = []
# -*- coding:utf-8 -*- #__author:Administrator #date: 2018/1/4 import os import json from public.MyHttp import Http from xlrd import open_workbook from public import ReadConfig from public.Log import MyLog import requests import time rc = ReadConfig.ReadConfig("808_config.ini") ht = Http() log = MyLog.get_log() logger = log.get_logger() def get_xls(xls_name, sheet_name): """ 获取excel表中指定sheet数据,保存到列表中返回 :param xls_name: excel文件名 :param sheet_name: sheet表名 :return: """ cls = [] xls_path = os.path.join(ReadConfig.proDir, "test_case_data", xls_name) # print(xls_path) file = open_workbook(xls_path) sheet = file.sheet_by_name(sheet_name) sheet_nrows = sheet.nrows