def setUp(self) -> None: self.t = do_excel.DoExcel(project_path.case_path, "invest")
def setUp(self) -> None: self.t = do_excel.DoExcel(project_path.case_path, "login") my_log.info("开始执行新一条测试用例")
import json from api_test.common import do_excel from api_test.common import project_path from api_test.common import my_log from api_test.common.http_request import HttpRequest import unittest from ddt import ddt, data from api_test.common import get_data from api_test.common.get_data import GetData from api_test.common.do_pymysql import DoMysql test_data = do_excel.DoExcel(project_path.case_path, "invest").read_case("InvestCase") my_log = my_log.MyLog() @ddt class TestCase(unittest.TestCase): def setUp(self) -> None: self.t = do_excel.DoExcel(project_path.case_path, "invest") def tearDown(self) -> None: pass @data(*test_data) def test_invest(self, case): method = case["Method"] url = case["Url"] param = eval(get_data.re_p(case["Params"])) if case["sql"] is not None:
import json from api_test.common import do_excel import unittest from api_test.common import project_path from api_test.common import my_log from api_test.common.http_request import HttpRequest from ddt import ddt, data my_log = my_log.MyLog() test_data = do_excel.DoExcel(project_path.case_path, "login").read_case("LoginCase") print(test_data) @ddt class TestCase(unittest.TestCase): def setUp(self) -> None: self.t = do_excel.DoExcel(project_path.case_path, "login") my_log.info("开始执行新一条测试用例") def tearDown(self) -> None: my_log.info("一条测试用例执行完毕") @data(*test_data) def test_login(self, case): method = case['Method'] url = case['Url'] param = eval(case['Params']) res = HttpRequest().http_request(method, url, param, cookies=None)
def setUp(self) -> None: self.t = do_excel.DoExcel(project_path.case_path, "recharge")
import json from api_test.common import do_excel from api_test.common import project_path from api_test.common import my_log from api_test.common.http_request import HttpRequest import unittest from ddt import ddt, data from api_test.common import get_data from api_test.common.get_data import GetData from api_test.common.do_pymysql import DoMysql test_data = do_excel.DoExcel(project_path.case_path, "recharge").read_case("RechargeCase") my_log = my_log.MyLog() @ddt class TestCase(unittest.TestCase): def setUp(self) -> None: self.t = do_excel.DoExcel(project_path.case_path, "recharge") def tearDown(self) -> None: pass @data(*test_data) def test_recharge(self, case): method = case["Method"] url = case["Url"] param = eval(get_data.re_p(case["Params"])) my_log.info('-------正在测试{}模块里面第{}条测试用例:{}'.format( case['Module'], case['CaseId'], case['Title']))
def setUp(self) -> None: self.t = do_excel.DoExcel(project_path.case_path, "add_loan")
import json from api_test.common import do_excel from api_test.common import project_path from api_test.common import my_log from api_test.common.http_request import HttpRequest import unittest from ddt import ddt, data from api_test.common import get_data from api_test.common.get_data import GetData from api_test.common.do_pymysql import DoMysql test_data = do_excel.DoExcel(project_path.case_path, "add_loan").read_case("AddLoanCASE") my_log = my_log.MyLog() @ddt class TestCase(unittest.TestCase): def setUp(self) -> None: self.t = do_excel.DoExcel(project_path.case_path, "add_loan") def tearDown(self) -> None: pass @data(*test_data) def test_add_loan(self, case): method = case["Method"] url = case["Url"] param = eval(get_data.re_p(case["Params"])) print(param) my_log.info('-------正在测试{}模块里面第{}条测试用例:{}'.format(case['Module'], case['CaseId'], case['Title'])) my_log.info('测试数据是:{}'.format(case))