self.config.set(section, option, value) def write(self): #修改配置文件结束后都需要调用改方法写入到配置文件 self.config.write(self.fp) def test_read(): rc = ReadConfig() host = rc.get_option('file', 'platform_address') items = rc.config.items('file') print(items) def test_write(): wc = WriteConfig() if ('addsection' not in wc.config): wc.add_section('addsection') wc.add_option('addsection', 'name', 'xiaobialong') wc.set_option('addsection', 'name', 'xiaobialong2') wc.write() if __name__ == '__main__': #test_read() #test_write() from interfaceFramework.public import sendRequest, parseConfig, utiles config = parseConfig.ReadConfig() excel = config.get_option('file', 'platform_address') test_data = utiles.read_excel(excel, '三年一班') print(test_data)
#!/usr/bin/env python #coding=utf-8 __author__ = '小白龙' import unittest from interfaceFramework.lib import paramunittest from interfaceFramework.public import sendRequest, parseConfig, utiles import os request = sendRequest.SendRequest() config = parseConfig.ReadConfig() excel = config.get_option('file', 'user_address') test_data = utiles.read_excel(excel, 'markCase') @paramunittest.parametrized(*test_data) class MarkCase(unittest.TestCase): """案件标记接口""" def setParameters(self, case_name, url, method, caseId, mark, code, message): self.host = config.get_option('host', 'edgeUser') self.case_name = case_name self.url = self.host + url self.method = method self.caseId = caseId self.mark = mark self.expect_code = int(code) self.expect_msg = message self.header = { 'Content-Type': "application/json",
#!/usr/bin/env python #coding=utf-8 __author__ = '小白龙' import unittest from interfaceFramework.lib import paramunittest from interfaceFramework.public import sendRequest, parseConfig, utiles request = sendRequest.SendRequest() config = parseConfig.ReadConfig() excel = config.get_option('file', 'user_address') test_data = utiles.read_excel(excel, 'add_cuiji') @paramunittest.parametrized(*test_data) class AddCuiji(unittest.TestCase): """案件标记接口""" def setParameters(self, case_name, url, method, caseId, encryptCallNumber, callStatus, statusCode, body, repayDate, code, message): self.host = config.get_option('host', 'edgeUser') self.case_name = case_name self.url = self.host + url self.method = method self.caseId = int(caseId) self.encryptCallNumber = encryptCallNumber self.callStatus = int(callStatus) self.statusCode = statusCode self.body = body self.repayDate = str(repayDate) print(repayDate)
#!/usr/bin/env python #coding=utf-8 __author__ = '小白龙' import unittest from interfaceFramework.lib import paramunittest from interfaceFramework.public import sendRequest, parseConfig, utiles import os request = sendRequest.SendRequest() config = parseConfig.ReadConfig() excel = config.get_option('file', 'user_address') test_data = utiles.read_excel(excel, 'caseImport') @paramunittest.parametrized(*test_data) class CaseImport(unittest.TestCase): """案件导入接口""" def setParameters(self, case_name, url, method, assetId, code, message): self.host = config.get_option('host', 'edgeUser') self.case_name = case_name self.url = self.host + url self.method = method self.assetId = assetId self.expect_code = int(code) self.expect_msg = message self.header = { 'Content-Type': "application/x-www-form-urlencoded", 'Cache-Control': "no-cache", 'content-type':
#!/usr/bin/env python #coding=utf-8 __author__ = '小白龙' import unittest from interfaceFramework.lib import paramunittest from interfaceFramework.public import sendRequest, parseConfig, utiles request = sendRequest.SendRequest() config = parseConfig.ReadConfig() excel = config.get_option('file', 'user_address') test_data = utiles.read_excel(excel, 'queryById') @paramunittest.parametrized(*test_data) class QueryById(unittest.TestCase): """查询消息详情接口""" def setParameters(self, case_name, url, method, msg_id, code, message): self.host = config.get_option('host', 'edgeUser') self.case_name = case_name self.url = self.host + url self.method = method self.msg_id = msg_id self.expect_code = int(code) self.expect_msg = message self.header = { 'Content-Type': "application/json", 'token': config.get_option('token', 'token') }
#!/usr/bin/env python #coding=utf-8 __author__ = '小白龙' import unittest from interfaceFramework.lib import paramunittest from interfaceFramework.public import sendRequest, parseConfig, utiles import os request = sendRequest.SendRequest() config = parseConfig.ReadConfig() excel = config.get_option('file', 'user_address') test_data = utiles.read_excel(excel, 'queryLoanByCase') @paramunittest.parametrized(*test_data) class QueryLoanByCase(unittest.TestCase): """案件标记接口""" def setParameters(self, case_name, url, method, caseId, code, message): self.host = config.get_option('host', 'edgeUser') self.case_name = case_name self.url = self.host + url self.method = method self.caseId = caseId self.expect_code = int(code) self.expect_msg = message self.header = { 'Content-Type': "application/json", 'token': config.get_option('token', 'token') }
#!/usr/bin/env python #coding=utf-8 __author__ = '小白龙' import unittest from interfaceFramework.lib import paramunittest from interfaceFramework.public import sendRequest, parseConfig, utiles import os request = sendRequest.SendRequest() config = parseConfig.ReadConfig() excel = config.get_option('file', 'user_address') test_data = utiles.read_excel(excel, 'caseAllot') @paramunittest.parametrized(*test_data) class CaseAllot(unittest.TestCase): """单个案件分配接口""" def setParameters(self, case_name, url, method, caseId, ownerId, code, message): self.host = config.get_option('host', 'edgeUser') self.case_name = case_name self.url = self.host + url self.method = method self.caseId = caseId self.ownerId = ownerId self.expect_code = int(code) self.expect_msg = message self.header = { 'Content-Type': "application/json",
#!/usr/bin/env python #coding=utf-8 __author__ = '小白龙' import unittest from interfaceFramework.lib import paramunittest from interfaceFramework.public import sendRequest, parseConfig, utiles import os request = sendRequest.SendRequest() config = parseConfig.ReadConfig() excel = config.get_option('file', 'user_address') test_data = utiles.read_excel(excel, 'goAllot') @paramunittest.parametrized(*test_data) class GoAllot(unittest.TestCase): """修改经办为分案状态""" def setParameters(self, case_name, url, method, userIdList, code, message): self.host = config.get_option('host', 'edgeUser') self.case_name = case_name self.url = self.host + url self.method = method self.userIdList = userIdList self.expect_code = int(code) self.expect_msg = message self.header = { 'Content-Type': "application/json", 'token': config.get_option('token', 'token') }
#!/usr/bin/env python #coding=utf-8 __author__ = '小白龙' import unittest from interfaceFramework.lib import paramunittest from interfaceFramework.public import sendRequest, parseConfig, utiles request = sendRequest.SendRequest() config = parseConfig.ReadConfig() excel = config.get_option('file', 'user_address') test_data = utiles.read_excel(excel, 'userQuery') @paramunittest.parametrized(*test_data) class UserQuery(unittest.TestCase): """查询用户信息接口""" def setParameters(self,case_name, url, method, assetId, userId,code, message): self.host = config.get_option('host', 'edgeUser') self.case_name = case_name self.url = self.host+url self.method = method self.assetId = assetId self.userId = userId self.expect_code = int(code) self.expect_msg = message self.header = {'Content-Type': "application/json",'token':config.get_option('token','token')} def test_query(self): print("执行测试用例:",self.case_name, self.url, self.method)
#!/usr/bin/env python #coding=utf-8 __author__ = '小白龙' import unittest from interfaceFramework.lib import paramunittest from interfaceFramework.public import sendRequest, parseConfig, utiles import os request = sendRequest.SendRequest() config = parseConfig.ReadConfig() excel = config.get_option('file', 'user_address') test_data = utiles.read_excel(excel, 'assistApply') @paramunittest.parametrized(*test_data) class AssistApply(unittest.TestCase): """申请协催接口""" def setParameters(self, case_name, url, method, caseId, applyRemark, code, message): self.host = config.get_option('host', 'edgeUser') self.case_name = case_name self.url = self.host + url self.method = method self.caseId = caseId self.applyRemark = applyRemark self.expect_code = int(code) self.expect_msg = message self.header = { 'Content-Type': "application/json",
#!/usr/bin/env python #coding=utf-8 __author__ = '小白龙' import unittest from interfaceFramework.lib import paramunittest from interfaceFramework.public import sendRequest, parseConfig, utiles request = sendRequest.SendRequest() config = parseConfig.ReadConfig() excel = config.get_option('file', 'user_address') test_data = utiles.read_excel(excel, 'read') @paramunittest.parametrized(*test_data) class Read(unittest.TestCase): """阅读消息接口""" def setParameters(self, case_name, url, method, msg_id, code, message): self.host = config.get_option('host', 'edgeUser') self.case_name = case_name self.url = self.host + url self.method = method self.msg_id = msg_id self.expect_code = int(code) self.expect_msg = message self.header = { 'Content-Type': "application/json", 'token': config.get_option('token', 'token') }
#!/usr/bin/env python #coding=utf-8 __author__ = '小白龙' import unittest from interfaceFramework.lib import paramunittest from interfaceFramework.public import sendRequest, parseConfig, utiles request = sendRequest.SendRequest() config = parseConfig.ReadConfig() excel = config.get_option('file', 'user_address') test_data = utiles.read_excel(excel, 'assetModify') @paramunittest.parametrized(*test_data) class AssetModify(unittest.TestCase): """案件标记接口""" def setParameters(self, case_name, url, method, id, name, type, importNumberDesensitization, restorationNumberDesensitization, code, message): self.host = config.get_option('host', 'edgeUser') self.case_name = case_name self.url = self.host + url self.method = method self.asset_id = int(id) self.name = name self.type = int(type) self.importNumberDesensitization = importNumberDesensitization self.restorationNumberDesensitization = restorationNumberDesensitization self.expect_code = int(code)
#!/usr/bin/env python #coding=utf-8 import unittest from interfaceFramework.lib import paramunittest from interfaceFramework.public import sendRequest, parseConfig, utiles request = sendRequest.SendRequest() config = parseConfig.ReadConfig() excel2 = config.get_option('file', 'tenant_address') test_data2 = utiles.read_excel(excel2, '三年一班') @paramunittest.parametrized(*test_data2) class TestCase2(unittest.TestCase): def setParameters(self, case_name, url, method, param1, param2): self.case_name = case_name self.url = url self.method = method self.param1 = param1 self.param2 = param2 def test_Case(self): print("执行测试用例:", self.case_name, self.url, self.method) urlstr = r"https://www.baidu.com/home/msg/data/personalcontent" request.set_url(self.url) if self.method == 'get': params = {"param1": self.param1, "param2": self.param2} request.set_params(params)