当前位置:网站首页>Jmeter 使用正则表达式提取器将返回值全部保存到一个文件中
Jmeter 使用正则表达式提取器将返回值全部保存到一个文件中
2022-08-09 19:31:00 【抓手】
目标:将响应数据 {"errorCode":0,"message":"success","data":null} 中的message字段的值全部保存到一个文件中。
1.正则表达式提取器
正则表达式:提取内容的正则表达式【()表示提取,对于你要提取的内容需要用小括号括起来】
模板:用$$引用起来,如果在正则表达式中有多个提取表达式(多个括号括起来的),则可以是$1$,$2$等等,表示解析到的第几个值给str,正则表达式的提取模式,值从1开始,
匹配数字(0代表随机):0代表随机,-1代表所有,其余正整数代表将在已提取的内容中,第几个匹配的内容。(因为源数据可能有多个相匹配的内容,匹配数字就是匹配第几个相匹配的内容)
缺省值:正则匹配失败时,取的值
2.BeanShell 后置处理程序
使用脚本将提取的数据输入到磁盘。
FileWriter fstream = new FileWriter("D:\\apache-jmeter-5.4.1\\bin\\结果\\响应结果.txt",true);
BufferedWriter out = new BufferedWriter(fstream);
out.write(vars.get("res")+"\n");
out.close();
fstream.close();
保存的响应结果
如果想将响应数据 {"errorCode":0,"message":"success","data":null} 全部保存下来,
正则表达式使用:{"errorCode":(.*?),"message":"(.*?)","data":(.*?)}
模板使用:{"errorCode":$1$,"message":"$2$","data":$3$}
边栏推荐
猜你喜欢
小满nestjs(第五章 nestjs cli)
Prometheus Operator 通过additional 添加target
数据集成API如何成为企业数字化转型的关键?
What are the benefits of enterprise data integration?How do different industries solve the problem of data access?
基于模糊PID控制器的水温控制系统仿真
【kali-权限提升】(4.2.7)社会工程学工具包:权限维持创建后门、清除痕迹
纸业供应链协同管理系统:重构纸业智慧供应网络,支撑企业数字化转型升级
win10配置CenterNet环境
大健康产业商业供应链管理系统数字化提升产业链运作效率推动供应链标准化建设
Simulation of Water Temperature Control System Based on Fuzzy PID Controller
随机推荐
『百日百题 · 基础篇』备战面试,坚持刷题 第五话——循环语句(2)!
Error when source install/setup.bash
Visual studio 2022 debugging skills introduction
hdu 3341 Lost's revenge(dp+Ac自动机)
人人都可以DIY的大玩具,宏光MINIEV GAMEBOY产品力强,出行新装备
visual studio 2022调试技巧介绍
Laravel之队列「建议收藏」
leetcode二叉搜索树与双向链表
小满nestjs(第六章 nestjs cli 常用命令)
没有 accept,我可以建立 TCP 连接吗?
安科瑞无线物联网智能电表ADW300指导性技术要求-Susie 周
嵌入式开发:使用FILL提高代码完整性
Unity_物体自转
【IoT毕设】STM32与机智云自助开发平台的宠物智能喂养系统
Reverse Analysis of Unknown Cryptographic Protocol Based on Network Data Flow
Number of daffodils within a thousand
Next second data: the transformation of the modern data stack brought about by the integration of lake and warehouse has begun
php安装make出现“collect2:error:ldreturned1exitstatus
leetcode 二叉树的分层遍历1
2.2 监督学习-1