Esempio n. 1
0
# -*- coding: utf-8 -*-
# @Author  : zgh
# @Email   : [email protected]
# @File    : manage.py
# @Software: PyCharm

from public.config import config
import pymysql
from conf import Allpath
from public.logger import Log
import time

now = time.strftime('%Y-%m-%d_%H_%M_%S')
logger = Log('auto_cases', Allpath.log_path)


class getMysqlInfo:
    def __init__(self, config_path, conf):
        # 传入参数:路径、便签、对象
        self.config = config().read_config(config_path, 'DBCONFIG', conf)
        logger.info("本次数据库调用配置成功!")

    def get_cnn(self):
        # 出入获取的配置文件,建立游标
        cnn = pymysql.connect(**self.config)
        return cnn

    def auto_insert(self):
        list_1 = {}
        cnn = self.get_cnn()
        cursor = cnn.cursor()
Esempio n. 2
0
import unittest
import time, shutil
import HTMLTestRunner_zgh
from public import Unit_test
from conf import Allpath
from public.get_mysql_info import getMysqlInfo
from public.writeExcel import writeExcel
from public.readExcel import readexcel
from public.smtp import massageMail
from public.logger import Log
import requests
import random

gmi = getMysqlInfo(Allpath.db_conf_path, 'config1')
logger = Log('auto_cases', Allpath.log_path)
#去随机数赋值图片名称
name = str(random.randint(0, 10))

# 2019年7月22日 10:40:51新增执行前清理原始用例结果记录
writeExcel(Allpath.test_data_path, 'Sheet1').Excel_dellog()

suite = unittest.TestSuite()  # 实例
loader = unittest.TestLoader()
# 测试模块
suite.addTest(loader.loadTestsFromModule(Unit_test))

now = time.strftime('%Y-%m-%d_%H_%M_%S')
file_path = Allpath.html_path + '/' + now + '.html'

with open(file_path, 'wb+') as file:
    # 实例化测试报告运行
Esempio n. 3
0
# -*- coding: utf-8 -*-
# @Author  : zgh
# @Email   : [email protected]
# @File    : readExcel.py
# @Software: PyCharm

import os
from public.config import config
from openpyxl import load_workbook
from conf import Allpath
from public.logger import Log

logger = Log('auto_cases', Allpath.log_path)
url_1 = str(config().read_config(Allpath.http_conf_path, 'HTTP', 'url'))
mode = config().read_config(Allpath.case_conf_path, 'FLAG', 'mode')
logger.info("用例执行模式(0全部执行,1执行指定配置接口):%s" % mode)
logger.info("服务地址配置:%s" % url_1)
case_list = config().read_config(Allpath.case_conf_path, 'FLAG', 'case_list')
logger.info("配置用例列表:%s" % case_list)


class readExcel:
    def __init__(self, file, sheet):
        self.file = file
        self.sheet = sheet

    def read_Excel(self):
        rd = load_workbook(self.file)
        sheet = rd[self.sheet]
        logger.info('本次获取测试用例成功,表单:%s' % sheet)
Esempio n. 4
0
import unittest
import time,shutil
import HTMLTestRunner_zgh
from public import Unit_test
from conf import Allpath
from public.get_mysql_info import getMysqlInfo
from public.writeExcel import writeExcel
from public.readExcel import readexcel
from public.smtp import massageMail
from public.logger import Log
import requests
import random

gmi=getMysqlInfo(Allpath.db_conf_path,'config1')
logger=Log('auto_cases',Allpath.log_path)
#去随机数赋值图片名称
name=str(random.randint(0,18))


# 2019年7月22日 10:40:51新增执行前清理原始用例结果记录
writeExcel(Allpath.test_data_path, 'Sheet1').Excel_dellog()

suite = unittest.TestSuite()  # 实例
loader = unittest.TestLoader()
# 测试模块
suite.addTest(loader.loadTestsFromModule(Unit_test))


now = time.strftime('%Y-%m-%d_%H_%M_%S')
file_path=Allpath.html_path+'/'+now+'.html'