예제 #1
0
 def __init__(self):
     global log, logger, resultPath
     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, "testCase")
     self.caseList = []
     print(self.caseListFile)
예제 #2
0
 def __init__(self):
     global baseurl, timeout
     baseurl = localreadconfig.get_http("baseURL")
     timeout = localreadconfig.get_http("timeout")
     self.log = Log.get_log()
     self.logger = self.log.get_logger()
     self.headers = {}
     self.params = {}
     self.data = {}
     self.url = None
     self.files = {}
     self.requestresult = {}
예제 #3
0
 def __init__(self):
     global host, port, timeout
     host = localReadConfig.get_http("baseurl")
     port = localReadConfig.get_http("port")
     timeout = localReadConfig.get_http("timeout")
     self.log = Log.get_log()
     self.logger = self.log.get_logger()
     self.headers = {}
     self.params = {}
     self.data = {}
     self.url = None
     self.files = {}
예제 #4
0
 def __init__(self):
     global host, port, timeout
     host = rc.get_http('baseurl')
     port = rc.get_http('port')
     timeout = int(rc.get_http('timeout'))
     self.log = Log.get_log()
     self.logger = self.log.get_logger()
     self.url = None
     self.header = {}
     self.params = {}
     self.data = {}
     self.file = {}
     self.status = 0
예제 #5
0
 def __init__(self):
     global host, port, timeout
     host = localReadConfig.get_http("baseurl")
     port = localReadConfig.get_http("port")
     if port:
         host = host + ':' + port
     else:
         host = host
     timeout = localReadConfig.get_http("timeout")
     self.log = Log.get_log()
     self.logger = self.log.logger
     self.headers = {}
     self.params = {}
     self.data = {}
     self.url = None
     self.files = {}
     self.cookies = requests.cookies.RequestsCookieJar()
 def __init__(self):
     global host, user, password, port, sender, title, content
     host = localReadConfig.get_email("mail_host")
     user = localReadConfig.get_email("mail_user")
     password = localReadConfig.get_email("mail_pass")
     port = localReadConfig.get_email("mail_port")
     sender = localReadConfig.get_email("sender")
     title = localReadConfig.get_email("subject")
     content = localReadConfig.get_email("content")
     self.value = localReadConfig.get_email("receiver")
     self.receiver = []
     # get receiver list
     for n in str(self.value).split("/"):
         self.receiver.append(n)
     # defined email subject
     date = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
     self.subject = title + " " + date
     self.log = MyLog.get_log()
     self.logger = self.log.get_logger()
     self.msg = MIMEMultipart('mixed')
예제 #7
0
    def __init__(self):
        global host, user, passwd, port, sender, title
        host = localReadConfig.get_email("mail_host")
        user = localReadConfig.get_email("mail_user")
        passwd = localReadConfig.get_email("mail_pass")
        sender = localReadConfig.get_email("sender")
        port = localReadConfig.get_email("mail_port")
        title = localReadConfig.get_email("subject")

        # get receiver list
        self.value = localReadConfig.get_email("receivers")
        self.receiver = []
        for n in str(self.value).split('/'):
            self.receiver.append(n)

        # defined email subject
        date = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
        self.subject = "Interface test report" + " " + date

        self.log = MyLog.get_log()
        self.logger = self.log.get_logger()
        self.msg = MIMEMultipart('related')
예제 #8
0
    def __init__(self):
        print "开始获取邮件配置信息..."
        global host, user, password, port, sender, title
        host = localReadConfig.get_email("mail_host")
        user = localReadConfig.get_email("mail_user")
        password = localReadConfig.get_email("mail_pwd")
        port = localReadConfig.get_email("mail_port")
        sender = localReadConfig.get_email("sender")
        title = localReadConfig.get_email("subject")
        # content = localReadConfig.get_email("content")
        # get receiver list
        try:
            if EMAIL == 'test':
                self.value = localReadConfig.get_email("receiver_test")
            elif EMAIL == 'online':
                self.value = localReadConfig.get_email("receiver_online")
                print '收件人信息', self.value
        except Exception as e:
            raise e
        self.receiver = []
        for n in str(self.value).split("/"):
            self.receiver.append(n)

        # defined email subject
        date = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
        self.subject = "接口测试报告" + " " + date
        # 获取测试报告路径
        # self.html_path = localReadConfig.get_report('report_url')
        f = open(report_file_path, 'r')
        self.html_path = f.readline()
        print "获取邮件信息完成..."

        self.log = MyLog.get_log()
        self.logger = self.log.get_logger()

        # 构造MIMEMultipart做为根容器
        # self.msg = MIMEMultipart('related')
        self.msg = MIMEMultipart()
예제 #9
0
    def __init__(self):
        global host, user, password, port, sender, title
        host = localReadConfig.get_email("mail_host")
        user = localReadConfig.get_email("mail_user")
        password = localReadConfig.get_email("mail_pass")
        port = localReadConfig.get_email("mail_port")
        sender = localReadConfig.get_email("sender")
        title = localReadConfig.get_email("subject")
        # content = localReadConfig.get_email("content")

        # 收件人列表
        self.value = localReadConfig.get_email("receiver")
        self.receiver = []
        for n in str(self.value).split("/"):
            self.receiver.append(n)

        # 定制邮件标题
        date = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
        self.subject = "接口测试报告" + " " + date

        self.log = MyLog.get_log()
        self.logger = self.log.get_logger()
        self.msg = MIMEMultipart('related')
예제 #10
0
import requests
import readConfig as readConfig
import os
from xlrd import open_workbook
from xml.etree import ElementTree as ElementTree
import configHttp as configHttp
from Log import MyLog
import json

localReadConfig = readConfig.ReadConfig()
proDir = readConfig.proDir
localConfigHttp = configHttp.ConfigHttp()
log = MyLog.get_log()
logger = log.get_logger()

caseNo = 0


def get_xls(xls_name, sheet_name):
    cls = []
    # get xls file's path
    xlsPath = os.path.join(proDir, "testFile", 'case', xls_name)
    # open xls file
    file = open_workbook(xlsPath)
    # get sheet by name
    sheet = file.sheet_by_name(sheet_name)
    # get one sheet's rows
    nrows = sheet.nrows
    for i in range(nrows):
        if sheet.row_values(i)[0] != u'case_name':
            cls.append(sheet.row_values(i))
예제 #11
0
import requests
import readConfig as readConfig
import os
from xlrd import open_workbook
from xml.etree import ElementTree as ElementTree
#from common import configHttp as configHttp
import configHttp
from Log import MyLog as Log
import json

localReadConfig = readConfig.ReadConfig()
proDir = readConfig.proDir
localConfigHttp = configHttp.ConfigHttp()
log = Log.get_log()
logger = log.get_logger()

caseNo = 0

# def get_visitor_token():
#     """
#     create a token for visitor
#     :return:
#     """
#     host = localReadConfig.get_http("BASEURL")
#     response = requests.get(host+"/v2/User/Token/generate")
#     info = response.json()
#     token = info.get("info")
#     logger.debug("Create token:%s" % (token))
#     return token

# def set_visitor_token_to_config():
예제 #12
0
 def __init__(self):
     self.log = Log.get_log()
     self.logger = self.log.logger
     self.db = None
     self.cursor = None