httprunner3源码解读(2)models.py (2)

 

AddressData class AddressData(BaseModel): """ 客户端与服务器地址数据 client_ip:客户端ip地址 client_port:客户端端口号 server_ip:服务器ip地址 server_port:服务器端口号 """ client_ip: Text = "N/A" client_port: int = 0 server_ip: Text = "N/A" server_port: int = 0

 

RequestData class RequestData(BaseModel): """ 请求数据 method:请求方法,默认为GET url:url地址 headers:请求头 cookies:cookie信息 body:请求体 """ method: MethodEnum = MethodEnum.GET url: Url headers: Headers = {} cookies: Cookies = {} body: Union[Text, bytes, List, Dict, None] = {}

 

ResponseData class ResponseData(BaseModel): """ 响应数据 status_code:状态码 headers:响应头 cookies:cookie信息 encoding:编码格式 content_type:内容类型 body:响应体 """ status_code: int headers: Dict cookies: Cookies encoding: Union[Text, None] = None content_type: Text body: Union[Text, bytes, List, Dict]

 

ReqRespData class ReqRespData(BaseModel): """ 请求响应数据 request:RequestData response:ResponseData """ request: RequestData response: ResponseData

 

SessionData class SessionData(BaseModel): """ request session data, including request, response, validators and stat data """ success: bool = False # in most cases, req_resps only contains one request & response # while when 30X redirect occurs, req_resps will contain multiple request & response req_resps: List[ReqRespData] = [] stat: RequestStat = RequestStat() address: AddressData = AddressData() validators: Dict = {}

 

StepData class StepData(BaseModel): """ teststep data, each step maybe corresponding to one request or one testcase 测试步骤数据,每个步骤可能对应一个请求或一个测试用例 """ success: bool = False name: Text = "" # teststep name data: Union[SessionData, List['StepData']] = None export_vars: VariablesMapping = {}

 

TestCaseSummary class TestCaseSummary(BaseModel): """ 测试用例结果 name:测试用例名字 success:测试用例成功的状态 case_id:测试用例的id time:测试用例的时间 in_out:测试用例的导入导出数据 log:测试用例的日志 step_datas:测试步骤的数据 """ name: Text success: bool case_id: Text time: TestCaseTime in_out: TestCaseInOut = {} log: Text = "" step_datas: List[StepData] = []

 

PlatformInfo class PlatformInfo(BaseModel): """ 平台信息 httprunner_version:httprunner版本号 python_version:python版本 platform:平台 """ httprunner_version: Text python_version: Text platform: Text

 

TestCaseRef class TestCaseRef(BaseModel): """ 包含testcase """ name: Text base_url: Text = "" testcase: Text variables: VariablesMapping = {}

 

TestSuite class TestSuite(BaseModel): """ 测试套件 TestSuite包含TestCaseRef TestCaseRef包含testcase """ config: TConfig testcases: List[TestCaseRef]

 

Stat class Stat(BaseModel): """ 统计信息 total:总数 success:成功的用例数 fail:失败的用例数 """ total: int = 0 success: int = 0 fail: int = 0

 

TestSuiteSummary class TestSuiteSummary(BaseModel): """ 测试套件结果 success:成功的状态 stat:统计信息 time:测试用例花费的时间 platform:平台信息 testcases:测试用例集 """ success: bool = False stat: Stat = Stat() time: TestCaseTime = TestCaseTime() platform: PlatformInfo testcases: List[TestCaseSummary]

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zwzgfs.html