def setUp(self): self.t = DoExcel(project_path.case_path, 'add_Loan')
def setUp(self): self.t = DoExcel(project_path.case_path, 'recharge')
import unittest from ddt import ddt, data from 接口自动化.API_5.common.http_request import HttpRequests from 接口自动化.API_5.common.do_excel import DoExcel from 接口自动化.API_5.common import project_path from 接口自动化.API_5.common.test_log import MyLog from 接口自动化.API_5.common.get_data import GetData # 测试充值 test_data = DoExcel(project_path.case_path, 'add_Loan').Read_Excel('Add_Loan_CASE') # COOKIES=None #设定COOKIES作为一个全局变量 @ddt class TestCases(unittest.TestCase): def setUp(self): self.t = DoExcel(project_path.case_path, 'add_Loan') def tearDown(self): pass @data(*test_data) def test_cases(self, case): global TestResult #声明全局变量 # global COOKIES # 执行用例 http = case['Url'] Method = case['Method'] param = eval(case['Params']) # print(type(param))
import unittest from ddt import ddt, data from 接口自动化.API_5.common.http_request import HttpRequests from 接口自动化.API_5.common.do_excel import DoExcel from 接口自动化.API_5.common import project_path from 接口自动化.API_5.common.test_log import MyLog from 接口自动化.API_5.common.get_data import GetData # 测试充值 test_data = DoExcel(project_path.case_path, 'recharge').Read_Excel('RechargeCASE') # COOKIES=None #设定COOKIES作为一个全局变量 @ddt class TestCases(unittest.TestCase): def setUp(self): self.t = DoExcel(project_path.case_path, 'recharge') def tearDown(self): pass @data(*test_data) def test_cases(self, case): global TestResult #声明全局变量 # global COOKIES # 执行用例 http = case['Url'] Method = case['Method'] param = eval(case['Params']) # print(type(param))
def setUp(self): self.t = DoExcel(project_path.case_path, 'register')
import unittest from ddt import ddt,data from 接口自动化.API_5.common.http_request import HttpRequests from 接口自动化.API_5.common.do_excel import DoExcel from 接口自动化.API_5.common import project_path from 接口自动化.API_5.common.test_log import MyLog # 测试注册 test_data = DoExcel(project_path.case_path, 'register').Read_Excel('RegisterCASE') COOKIES=None #设定COOKIES作为一个全局变量 @ddt class TestCases(unittest.TestCase): def setUp(self): self.t = DoExcel(project_path.case_path, 'register') def tearDown(self): pass @data(*test_data) def test_cases(self,case): global TestResult # 执行用例 http = case['Url'] Method = case['Method'] param = eval(case['Params']) # 发起测试 print('-----------------正在测试{}模块里的第{}条测试用例---------------------'.format(case['Module'],case['CaseID'])) # MyLog().info('正在执行{}模块的第{}条测试用例'.format(Module, CaseID)) resp = HttpRequests().requests(http, Method, param,COOKIES) print('实际结果:{}'.format(resp.json())) #发送请求拿到的实际返回值 # MyLog().info('实际结果是:{}'.format(resp.json())) # http发送请求拿到的实际返回值 # 对比结果
def setUp(self): self.t = DoExcel(project_path.case_path, 'withdraw')
import unittest from ddt import ddt, data from 接口自动化.API_5.common.http_request import HttpRequests from 接口自动化.API_5.common.do_excel import DoExcel from 接口自动化.API_5.common import project_path from 接口自动化.API_5.common.test_log import MyLog from 接口自动化.API_5.common.get_data import GetData # 测试加标 test_data = DoExcel(project_path.case_path, 'withdraw').Read_Excel('WithdrawCASE') # COOKIES=None #设定COOKIES作为一个全局变量 @ddt class TestCases(unittest.TestCase): def setUp(self): self.t = DoExcel(project_path.case_path, 'withdraw') def tearDown(self): pass @data(*test_data) def test_cases(self, case): global TestResult #声明全局变量 # global COOKIES # 执行用例 http = case['Url'] Method = case['Method'] param = eval(case['Params']) # print(type(param))