jmeter关联练习题(正则、jsonpath)--能做出来,关联就基本没问题了
练习一:获取“接口”二字前面的那个value值
说明:“接口”二字在响应中只出现一次
也就是获取
option个数、位置都固定,获取“接口”二字前面的value值
<option value="8a818111754a4e0c01754f87c94d0071">https://www.cnblogs.com/uncleyong</option> <option value="8a8181117738a88f0177390675e001d7">接口测试-阿里直播设置域名编辑后.com</option> </select> </div> </div>
option个数、位置都不固定,获取“接口”二字前面的value值
可能是下面多种情况
比如:位置不固定
<option value="8a8181117738a88f0177390675e001d7">接口测试-阿里直播设置域名编辑后.com</option> <option value="8a818111754a4e0c01754f87c94d0071">https://www.cnblogs.com/uncleyong</option> </select> </div> </div>
也可能是:option个数不固定
<option value="8a818111754a4e0c01754f87c94d0071">https://www.cnblogs.com/uncleyong</option> <option value="8a8181117738a88f0177390675e001d7">接口测试-阿里直播设置域名编辑后.com</option> <option value="01754f87c94d00718a818111754a4e0c">www.baidu.com</option> </select> </div> </div>
练习二:获取showname为“全栈测试笔记”的uuid
说明:showname个数、位置都不确定;至少两种方法实现
{"code":20000,"msg":"成功","data":{"count":34,"next":"http://***.***-vip.cn/admin_api/v1/consultant/?page=2","previous":null,"results":[{"uuid":"PjYW29qsY9xkWt2pxuYpb8","showname":"超级用户","mobile":"18888888888","level":4,"is_tmk":1,"group":"销售组001,销售组002,销售组006,xm1销售组1,测试简化,测试简化222222,考研潜在客户组,考研TMK二电"},{"uuid":"CuvM58cudnKYZcuoNVSPSQ","showname":"测试01","mobile":"18111111111","level":4,"is_tmk":1,"group":"销售组001,销售组002,销售组006,xm1销售组1,测试简化,测试简化222222,考研潜在客户组"},{"uuid":"sbSvXLB8vQS6GPNEESqfAg","showname":"测试02","mobile":"19999999999","level":4,"is_tmk":1,"group":"销售组001,销售组002,销售组006,xm1销售组1,xm1销售组2,测试简化,测试简化222222"},{"uuid":"h2yfwgkLmebqAnMvaBBRa4","showname":"测试03","mobile":"17352410310","level":2,"is_tmk":1,"group":"销售组001,销售组002,xm1销售组1,xm1销售组2,测试简化,测试简化222222"},{"uuid":"baJsmR2uVeDA79jbg8Eja6","showname":"测试01","mobile":"18662466691","level":1,"is_tmk":1,"group":"销售组001,销售组002"},{"uuid":"mVmVANpQbrbVmmWghHfSqN","showname":"测试04","mobile":"18860916422","level":1,"is_tmk":0,"group":"销售组001,销售组002,销售组006,xm1销售组1,xm1销售组2"},{"uuid":"qvSAeRif9ps56k7fJvTFCn","showname":"测试05","mobile":"15751595832","level":1,"is_tmk":0,"group":"销售组001,销售组002,销售组006,xm1销售组1,xm1销售组2,测试简化,测试简化222222"},{"uuid":"uNkh2t4MiHZt5Pk9KtNatL","showname":"全栈测试笔记","mobile":"13776238213","level":1,"is_tmk":0,"group":"销售组001,考研TMK二电"}]}}
格式化数据
{ "code": 20000, "msg": "成功", "data": { "count": 34, "next": "http://***.***-vip.cn/admin_api/v1/consultant/?page=2", "previous": null, "results": [ { "uuid": "PjYW29qsY9xkWt2pxuYpb8", "showname": "超级用户", "mobile": "18888888888", "level": 4, "is_tmk": 1, "group": "销售组001,销售组002,销售组006,xm1销售组1,测试简化,测试简化222222,考研潜在客户组,考研TMK二电" }, { "uuid": "CuvM58cudnKYZcuoNVSPSQ", "showname": "测试01", "mobile": "18111111111", "level": 4, "is_tmk": 1, "group": "销售组001,销售组002,销售组006,xm1销售组1,测试简化,测试简化222222,考研潜在客户组" }, { "uuid": "sbSvXLB8vQS6GPNEESqfAg", "showname": "测试02", "mobile": "19999999999", "level": 4, "is_tmk": 1, "group": "销售组001,销售组002,销售组006,xm1销售组1,xm1销售组2,测试简化,测试简化222222" }, { "uuid": "h2yfwgkLmebqAnMvaBBRa4", "showname": "测试03", "mobile": "17352410310", "level": 2, "is_tmk": 1, "group": "销售组001,销售组002,xm1销售组1,xm1销售组2,测试简化,测试简化222222" }, { "uuid": "baJsmR2uVeDA79jbg8Eja6", "showname": "测试01", "mobile": "18662466691", "level": 1, "is_tmk": 1, "group": "销售组001,销售组002" }, { "uuid": "mVmVANpQbrbVmmWghHfSqN", "showname": "测试04", "mobile": "18860916422", "level": 1, "is_tmk": 0, "group": "销售组001,销售组002,销售组006,xm1销售组1,xm1销售组2" }, { "uuid": "qvSAeRif9ps56k7fJvTFCn", "showname": "测试05", "mobile": "15751595832", "level": 1, "is_tmk": 0, "group": "销售组001,销售组002,销售组006,xm1销售组1,xm1销售组2,测试简化,测试简化222222" }, { "uuid": "uNkh2t4MiHZt5Pk9KtNatL", "showname": "全栈测试笔记", "mobile": "13776238213", "level": 1, "is_tmk": 0, "group": "销售组001,考研TMK二电" } ] } }
最新原文:https://www.cnblogs.com/uncleyong/p/14329139.html
__EOF__
本文作者:持之以恒(韧)
关于博主:擅长性能、全链路、自动化、企业级自动化持续集成(DevTestOps)、测开等
面试必备:项目实战(性能、自动化)、简历笔试,https://www.cnblogs.com/uncleyong/p/15777706.html
测试提升:从测试小白到高级测试修炼之路,https://www.cnblogs.com/uncleyong/p/10530261.html
欢迎分享:如果您觉得文章对您有帮助,欢迎转载、分享,也可以点击文章右下角【推荐】一下!
关于博主:擅长性能、全链路、自动化、企业级自动化持续集成(DevTestOps)、测开等
面试必备:项目实战(性能、自动化)、简历笔试,https://www.cnblogs.com/uncleyong/p/15777706.html
测试提升:从测试小白到高级测试修炼之路,https://www.cnblogs.com/uncleyong/p/10530261.html
欢迎分享:如果您觉得文章对您有帮助,欢迎转载、分享,也可以点击文章右下角【推荐】一下!