A04 _ Httprunner general _ 02 _ extract data _ 01 _ extract关键字简述
编写用例时,HttpRunner支持从响应中提取所需的数据,将其分配给变量或声明它。
提取数据键:提取
支持的提取方法:
Regex模式,通过正则表达式从HTML文本中提取指定内容。示例:td width='\d{3} '(。*)/td
Delemeter是指通过分隔符从JSON或HTML文本中获取内容。例如content.data.authCodeToken
Jsonpath模式,通过jsonpath表达式语法从JSON实体中提取内容。例如$ $.价格
\ httprunner-2 . 5 . 5 \ httprunner \ response . py:
对应于三种提取方法的源函数
类响应对象(对象):
def _ extract _ field _ with _ JSON path(self,field)
def _ extract _ field _ with _ regex(self,field)
def _ extract _ field _带分隔符
此外,关于HttpRunner的各种问题,请查看GitHub的问题区域。下图是新增jsonpath的反馈说明:
https://github.com/httprunner/httprunner/issues
集线器问题中添加jsonpath表达式的方法说明