标签:table main 界面 没有 blog style border 类型 rand
如果你想从头学习Jmeter,可以看看这个系列的文章哦
https://www.cnblogs.com/poloyy/category/1746599.html
我们通过实际栗子去讲述理论知识点
字段 | 含义 |
Apply to | 应用范围,选默认的 main sample only 就行了 |
Field to check |
可提取的字段 |
Names of created variables |
|
Regular Expression |
正则表达式 |
Template | 从找到的匹配项中创建字符串的模板 |
Match No.(0 for Random) |
|
Default Value |
|
Use empty default value |
勾选后,提取不到值时,则返回空字符串 |
属性 | 含义 |
Body | 响应体,不包括响应头;最常用 |
Body (unescaped) | 响应体,替换了所有HTML转义符;不建议使用 |
Body as a Document | 从不同类型的文件中提取文本;影响性能 |
Request Headers | 请求头 |
Response Headers | 响应头 |
URL | URL |
Response Code | 响应码 |
Response Message | 响应信息 |
这个栗子,我都会以这个地址的接口来完成 JSON 提取器的实战栗子,大家可以注册个账号玩一玩哦
http://api.yesapi.cn/docs.php?keyword=%E4%BC%9A%E5%91%98&channel=api
下面多个栗子都以这个测试计划为基础哦
登录是执行其他接口的前置接口,所以要获取用户登录后的 token、uuid
下面的栗子都以这个 JSON 字符串为基础,从里面提取结果
这 JSON 字符串也是某个接口的响应内容,货真价实,感兴趣也可以自己玩一玩:http://api.yesapi.cn/docs-api-App.User.GetList.html
{ "ret": 200, "msg": "V2.5.1 YesApi App.User.GetList", "data": { "total": 4, "err_msg": "", "err_code": 0, "users": [ { "role": "user", "status_desc": "正常", "reg_time": "2020-06-22 20:45:05", "role_desc": "普通会员", "ext_info": { "yesapi_nickname": "", "yesapi_points": 0 }, "uuid": "0564CE592B4CE914365D8922F6FC4CEC", "username": "luojunjiess286", "status": 0 }, { "role": "user", "status_desc": "正常", "reg_time": "2020-06-22 14:27:17", "role_desc": "普通会员", "ext_info": { "yesapi_nickname": "", "yesapi_points": 0 }, "uuid": "0164DC0680F84DCE40D3DD4A36640ECA", "username": "luojunjiessa", "status": 0 }, { "role": "admin", "status_desc": "正常", "reg_time": "2020-03-23 22:48:32", "role_desc": "管理员", "ext_info": { "yesapi_nickname": "", "yesapi_points": 0 "yesapi_reg_source": "" }, "uuid": "079BF6BB82AFCFC7084F96AECAF0519F", "username": "luojunjiess", "status": 0 } ] } }
就是正则表达式里只有一个 ( ) ,且 Match No. 不是 -1
uuid1= uuid1_g=1 uuid1_g0="uuid":"0564CE592B4CE914365D8922F6FC4CEC" uuid1_g1=0564CE592B4CE914365D8922F6FC4CEC
如果正则匹配到值,但是没有填模板,则返回空
uuid2="uuid":"0564CE592B4CE914365D8922F6FC4CEC" uuid2_g=1 uuid2_g0="uuid":"0564CE592B4CE914365D8922F6FC4CEC" uuid2_g1=0564CE592B4CE914365D8922F6FC4CEC
uuid3=0564CE592B4CE914365D8922F6FC4CEC uuid3_g=1 uuid3_g0="uuid":"0564CE592B4CE914365D8922F6FC4CEC" uuid3_g1=0564CE592B4CE914365D8922F6FC4CEC
uuid4=null uuid4_g=1 uuid4_g0="uuid":"0564CE592B4CE914365D8922F6FC4CEC" uuid4_g1=0564CE592B4CE914365D8922F6FC4CEC
$2$ 模板并不存在,其实就是 uuid4_g2 变量不存在,即使勾了使用空默认值,也返回 null,
有两种情况
手动分成四部分
uuid1_1=0564CE592B4CE914365D8922F6FC4CEC uuid1_1_g=1 uuid1_1_g0="uuid":"0564CE592B4CE914365D8922F6FC4CEC" uuid1_1_g1=0564CE592B4CE914365D8922F6FC4CEC uuid1_2=0164DC0680F84DCE40D3DD4A36640ECA uuid1_2_g=1 uuid1_2_g0="uuid":"0164DC0680F84DCE40D3DD4A36640ECA" uuid1_2_g1=0164DC0680F84DCE40D3DD4A36640ECA uuid1_3=079BF6BB82AFCFC7084F96AECAF0519F uuid1_3_g=1 uuid1_3_g0="uuid":"079BF6BB82AFCFC7084F96AECAF0519F" uuid1_3_g1=079BF6BB82AFCFC7084F96AECAF0519F uuid1_matchNr=3
info1= info1_g=2 info1_g0="uuid":"0564CE592B4CE914365D8922F6FC4CEC","username":"luojunjiess286" info1_g1=0564CE592B4CE914365D8922F6FC4CEC info1_g2=luojunjiess286
info2=0564CE592B4CE914365D8922F6FC4CEC info2_g=2 info2_g0="uuid":"0564CE592B4CE914365D8922F6FC4CEC","username":"luojunjiess286" info2_g1=0564CE592B4CE914365D8922F6FC4CEC info2_g2=luojunjiess286
info3=0564CE592B4CE914365D8922F6FC4CECluojunjiess286 info3_g=2 info3_g0="uuid":"0564CE592B4CE914365D8922F6FC4CEC","username":"luojunjiess286" info3_g1=0564CE592B4CE914365D8922F6FC4CEC info3_g2=luojunjiess286 info4=0564CE592B4CE914365D8922F6FC4CEC,luojunjiess286 info4_g=2 info4_g0="uuid":"0564CE592B4CE914365D8922F6FC4CEC","username":"luojunjiess286" info4_g1=0564CE592B4CE914365D8922F6FC4CEC info4_g2=luojunjiess286
标签:table main 界面 没有 blog style border 类型 rand
原文地址:https://www.cnblogs.com/poloyy/p/13179150.html