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 ...
随机推荐
- innodb和myisam对比
MyISAM特点 1)不支持行锁(MyISAM只有表锁),读取时对需要读到的所有表加锁,写入时则对表加排他锁: 2)不支持事务 3)不支持外键 4)不支持崩溃后的安全恢复 5)在表有读取查询的同时,支 ...
- 分析mybatis中 #{} 和${}的区别
分析方法: 在 GenericTokenParser这个类的parse方法的这一行下个断点调试一下就明白了 builder.append(handler.handleToken(content)); ...
- java全套学习资料
1.背景 技术需要大家的共同努力,在这里我将平时学习过的觉得比较好的资料分享给大家; 当然,最好的学习就是输出,与大家分享,在分享的资料中有的是自己的总结,有的是分享来自互联网,如果有侵权请联系删除; ...
- PHP如何创建文件夹(mkdir的用法,mkdirs的语法)【转】
(PHPmkdir如何创建多级目录) 在开始之前,我先说明一下,可能许多朋友与我一样认为只要给一个路径,mkdir就可以创建文件夹,其它不是那样,单个的MKDIR只能创建一级目录,对于多级的就不 ...
- 快速生成mysql上百万条测试数据
方案:编写一个存储过程循环添加数据 1. 创建表index_test DROP TABLE IF EXISTS index_test; CREATE TABLE index_test( id ) PR ...
- 十六、python面向对象基础篇
面向对象基础: 在了解面向对象之前,先了解下变成范式: 编程范式是一类典型的编程风格,是一种方法学 编程范式决定了程序员对程序执行的看法 oop中,程序是一系列对象的相互作用 python支持多种编程 ...
- vuex相关
作用:对项目里多个组件的共享状态进行集中式管理(读/写) .
- maven 配置文件
<properties> <project.builder.sourcesEncoding>UTF-8</project.builder.sourcesEncoding& ...
- JDK1.8 LocalDate 使用方式;LocalDate 封装Util,LocalDate工具类(三)
未完待续 ........ 前言: 大企鹅的日常分享,第三步,最近一直在想策略设计模式和工厂模式结合优化ifelse的写法,看了很多资料,终于写出了自己要写的东西,在这段时间里,也有求助小伙伴,但是, ...
- vs2008 vc90.pdb 不是创建此预编译头时使用的 pdb 文件,请重新创建预编译头
解决方案: 找到项目中的stdafx.cpp,右键属性,找到C/C++->预编译头, 设置为创建预编译头, 重新生成