示例#1
0
 def __init__(self):
     global scheme, host, port, timeout  # 定义全局变量
     scheme = localReadConfig.get_http("scheme")  # https or http
     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 = {}
     self.state = 0
     self.cookies = 0
示例#2
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")

        # get receiver list
        self.value = localReadConfig.get_email("receiver")
        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.log = MyLog.get_log()
        self.logger = self.log.get_logger()
        self.msg = MIMEMultipart('related')
示例#3
0
import random
import time
import paramiko

from comMon.Log import MyLog as Log

log = Log.get_log()
mylogger = log.get_logger()
import readConfig as readConfig

dir = readConfig.proDir
localReadConfig = readConfig.ReadConfig()


def get_number():
    # 第二位数字

    second = [3, 4, 5, 7, 8][random.randint(0, 4)]

    # 第三位数字
    third = {
        3: random.randint(0, 9),
        4: [5, 7, 9][random.randint(0, 2)],
        5: [i for i in range(10) if i != 4][random.randint(0, 8)],
        7: [i for i in range(10) if i not in [4, 9]][random.randint(0, 7)],
        8: random.randint(0, 9),
    }[second]

    # 最后八位数字
    suffix = random.randint(9999999, 100000000)
示例#4
0
 def setUpClass(cls):
     cls.browser = BasePage()
     cls.driver = cls.browser.pc_open_browser()
     cls.log = MyLog.get_log()
     cls.logger = cls.log.get_logger()
     cls.url = localReadConfig.get_defaultUrl("URL")
示例#5
0
sys.path.append(curPath)
import unittest

from comMon.Log import MyLog

import HTMLTestRunner


class userRegister(unittest.TestCase):
    def test001(self):
        print("001")
        pass

    def test002(self):
        print("002")
        pass


if __name__ == '__main__':
    log = MyLog.get_log()
    resultPath = log.get_Onereport_path()
    test_suite = unittest.TestSuite()  # 创建一个测试集合
    test_suite.addTest(userRegister("test001"))  # 测试套件中添加测试用例
    # test_suite.addTest(unittest.makeSuite(MyTest))#使用makeSuite方法添加所有的测试方法
    fp = open(resultPath, 'wb')  # 打开一个保存结果的html文件
    print(resultPath)
    runner = HTMLTestRunner.HTMLTestRunner(stream=fp)
    # 生成执行用例的对象
    runner.run(test_suite)
    fp.close()
示例#6
0
 def __init__(self):
     self.log = Log.get_log()
     self.logger = self.log.get_logger()
     self.db = None
     self.cursor = None