Example #1
0
import unittest

import ddt

from Public.expect import assertre
from Public.get_excel import makedata
from Public.log import Log
from Public.select_request import TestApi

data_test = makedata()
logger = Log()


def my_print(msg):
    logger.info(msg)


@ddt.ddt
class MyTest(unittest.TestCase):
    def setUp(self):
        my_print('测试用例开始执行')

    def tearDown(self):
        my_print('测试用例执行完毕')

    @ddt.data(*data_test)
    def test_api(self, data_test):
        my_print('获取用例数据:%s' % data_test)
        api = TestApi(url=data_test['url'],
                      key=data_test['key'],
                      connent=data_test['coneent'],
Example #2
0
# coding=utf-8
import json, jsonpath, time, re
from interface.testfengzhuang import TestApi
from Public.get_excel import makedata
import ddt, unittest
from Public.log import logger, LOG
from Public.MyTest import MyTest

# 加载测试用例文档数据
date_test = makedata('回归_interface_2021.xls', 1)
LOG.info("加载测试用例数据:{}".format(date_test))
# date_test.pop(3)
# date_test.pop(3)
# date_test.pop(3)
# LOG.info("加载测试用例数据:{}".format(date_test))
# lists = []


@ddt.ddt
class Atest(MyTest):
    """项目名称【自动化统计系统】"""
    @ddt.data(*date_test)
    @logger("test_atest_api")
    def test_atest_api(self, date):
        # LOG.info("输入参数:{}".format(date['url']))
        try:
            ASD
        except NameError as msg:
            pass
        # 对excel取到的请求参数进行初步格式判断
        if date['preset'] != "":