Esempio n. 1
0
with open(file_path, 'wb+') as file:
    # 实例化测试报告运行
    runner = HTMLTestRunner_zgh.HTMLTestRunner(
        stream=file,
        verbosity=2,
        tester='质量保障部—章广华',
        title='智能客服接口自动化测试报告【Python】',
        description='该测试报告仅体现某接口请求以及参数值验证情况。')
    # 传入测试运行对象
    runner.run(suite)

text = eval(
    gmi.get_mysql_info_test("select * from znkf ORDER BY date DESC LIMIT 10;",
                            1)['restult'])
logger.info('获取表单内容成功:%s' % text)
#钉钉智能消息机器人智能客服
url = 'https://oapi.dingtalk.com/robot/send?access_token=63c284d1de43c21162fe642e'
#测试地址
# url='https://oapi.dingtalk.com/robot/send?access_token=7bb026b0b9029378890c5f14fcc106be9ab5725e'
headers = {"Content-Type": "application/json"}
data = {
    "msgtype": "markdown",
    "markdown": {
        "title":
        "智能客服接口自动化测试报告",
        "text":
        "#### 智能客服接口自动化测试报告【V0.3】\n" + "> 【测试人员】:" + str(text['testname']) +
        "\n" + "\n> 【开始时间】:" + str(text['time']) + "\n" + "\n> 【合计耗时】:" +
        str(text['sumtime']) + "\n" + "\n> 【本次结果】:" + str(text['testresult']) +
        "\n" + "\n> 【通过率】:" + str(text['tonggl']) + "\n" +
Esempio n. 2
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. 3
0
# 测试模块
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:
    # 实例化测试报告运行
    runner=HTMLTestRunner_zgh.HTMLTestRunner(stream=file, verbosity=2, tester='质量保障部—章广华',title='安全核验接口自动化测试报告【Python】',
                                             description='该测试报告仅体现某接口请求以及参数值验证情况。')
    # 传入测试运行对象
    runner.run(suite)

text=eval(gmi.get_mysql_info("select * from aqhy ORDER BY date DESC LIMIT 10;",1)['restult'])
logger.info('获取数据库测试结果内容成功:%s' % text)
#钉钉智能消息机器人智能客服
# url='https://oapi.dingtalk.com/robot/send?access_token=171c03789a58465e92cb4108a366de083cda389841f59d40d84980fb'
#测试地址
# url='https://oapi.dingtalk.com/robot/send?access_token=9abe322cb85c9a877bb026b0b9029378890c5f14fcc106be9ab5725e'
headers={"Content-Type":"application/json"}
data={
     "msgtype": "markdown",
     "markdown": {
         "title": "安全核验接口自动化测试报告",
         "text": "#### 安全核验接口自动化测试报告【V1.0.0】\n" +
                 "> 【测试人员】:"+str(text['testname']) + "\n" +
                 "\n> 【开始时间】:"+str(text['time']) + "\n" +
                 "\n> 【合计耗时】:"+str(text['sumtime']) + "\n" +
                 "\n> 【本次结果】:"+str(text['testresult']) + "\n" +
                 "\n> 【通过率】:"+str(text['tonggl']) + "\n" +