JSR223 PostProcessor VS BeanShell PostProcessor in JMeter
I would recommend using JSR223 PostProcessor
About performance:
In JMeter's official user manual, About reducing resource requirements in Best Practice. There is one suggestion said that "Use the most performing scripting language (see JSR223 section)" , as Beanshell Processfor reduces JMeter's performance.
About parse JSON response:
And I found that it is more easy to parse JSON response compared with BeanShell PostProcessor . As JSR223 PostProcessor supports Groovy, this is easy to parse JSON using Groovy, no need to import additional JAR packages.
Example One:
import groovy.json.JsonSlurper def jsonSlurper = new JsonSlurper();
String response=prev.getResponseDataAsString();
//log.info("response" + response);
def object = jsonSlurper.parseText(response);
dataAllReady = object.data.dataAllReady;
Example Two:
import groovy.json.JsonOutput
import groovy.json.JsonSlurper def jsonSlurper = new JsonSlurper();
def response = jsonSlurper.parseText(prev.getResponseDataAsString());
def json = JsonOutput.toJson(response.details[0].outBound[0]);
vars.put("json", json);
Reference:
- Parsing and producing JSON - to learn how to work with JSON in Groovy
- Beanshell vs JSR223 vs Java JMeter Scripting: The Performance-Off You've Been Waiting For!
JSR223 PostProcessor VS BeanShell PostProcessor in JMeter的更多相关文章
- Jmeter BeanShell PostProcessor提取json数据
需求:提取sample返回json数据中所有name字段值,返回的json格式如下: {“body”:{“apps”:[{“name”:”111”},{“name”:”222”}]}} jmeter中 ...
- jmeter 之 BeanShell PostProcessor跨线程全局变量使用
BeanShell PostProcessor是用户对一些变量的操作,操作方法很灵活,大概原理是通过parameters传回来对象,然后在script中对对象进行操作 场景:从登陆接口中获取token ...
- Jmeter中JDBC Request和BeanShell PostProcessor的结合使用(SQL模糊查询)
[前言] 今天记录一下Jmeter中JDBC Request和BeanShell PostProcessor的结合使用的方法(SQL模糊查询) [步骤] 1.下载对应数据库的驱动包到jmeter安装目 ...
- 二、Jmeter 后置处理器(BeanShell PostProcessor)
1.新建JDBC Request,如下图所示: 重要的参数说明: Variable Name:数据库连接池的名字,需要与JDBC Connection Configuration的Variable N ...
- jmeter中beanshell postprocessor结合fastjson库提取不确定个数的json参数
在项目实践中,遇到了这样一个问题.用jmeter作http接口测试,需要的接口参数个数是不确定的.也就是说,在每次测试中,根据情况不同,可能页面中的列表中所含的参数个数是不确定的,那么要提取的参数个数 ...
- Jmeter---后置处理器 BeanShell PostProcessor 获取JDBC结果(多行)并以列表传入另一个请求
之前用python+locust对脚本生成商品编码, 商品上架,购买商品进行编写脚本和压测: 开始是打算用Jmeter,后来遇到问题在 Jmeter如何读取JDBC多行并组成列表,作为下一个请求 一直 ...
- beanshell postprocessor解决编码
beanshell postprocessor String s=new String(prev.getResponseData(),"UTF-8"); char ...
- JMeter组件之BeanShell PostProcessor的使用
1. 场景一:获取请求响应中的数据,并保存 import com.alibaba.fastjson.*; // 引入包.这个包需要先放在:<安装目录>\apache-jmeter-3.2 ...
- jmeter beanshell postprocessor 使用
String newtoken=bsh.args[0];print(newtoken);${__setProperty(newtoken,${token},)}; String newcompanyI ...
随机推荐
- python高级编程——入门语法(一)
元类 在python中一切皆对象,类也是对象,只不过类是一个创建对象的对象,我们可以在类中动态的创建一个类,比如 def func(name): if name == "Plane" ...
- idea跳转到指定行列快捷键
快捷键 Ctrl + G :
- java hibnernet测试@test 时不提交保存的事务
开始保存时不能提交数据报错: org.hibernate.HibernateException: Could not obtain transaction-synchronized Session f ...
- 如何开发出成功的iOS应用(流程图)
转自:http://mobile.51cto.com/hot-307342.htm 近来,肥沃的应用开发土壤不断孕育出一个个振奋人心的故事,成千上万的人都觊觎从这个机遇无限的领域中分一杯羹.虽然现在的 ...
- yuv420 转换成 bmp
源码如下: // ConsoleApplication1.cpp : Defines the entry point for the console application. #include &qu ...
- 张兴盼-201871010131 《面向对象程序设计(java)》第六、七周学习总结
张兴盼-201871010131 <面向对象程序设计(java)>第六.七周学习总结 项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh ...
- 装ubuntu的坑
装ubuntu安装盘的U盘,在BOOT中会出现两种载入方式,切记不要用UEFI方式打开,否则安装ubuntu会在最后卡在GRUB的安装上面,然后失败.
- Python进阶-III 函数装饰器(Wrapper)
1.引入场景: 检查代码的运行时间 import time def func(): start = time.time() time.sleep(0.12) print('看看我运行了多长时间!') ...
- Selenium请求库
阅读目录 一 介绍 二 安装 三 基本使用 四 等待元素被加载 五 选择器 六 元素交互操作 七 其他 八 项目练习 九 破解登录验证 一 介绍 1.selenium是什么? selenium最初是一 ...
- Educational Codeforces Round 78 (Rated for Div. 2) C - Berry Jam(前缀和)