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 ...
随机推荐
- 用QT 还是MFC
转自:用QT 还是MFC ? ----不要在跟自己无关的事情上浪费时间 - CSDN博客 http://blog.csdn.net/sergery/article/details/8038897 我 ...
- ES6 对象的拓展(三)
一.对象中的属性及方法1.属性属性简写:当对象属性名与属性值变量相同可以简写eg: let [name,age]=['nzc','18']; let obj = { name:name, age:ag ...
- iOS/Xcode异常:no visible @interface for XXX declares the selector YYY
在iOS/Xcode开发过程中,出现如下异常信息: no visible @interface for XXX declares the selector YYY 分析原因: There are lo ...
- Kubernetes概念之mater、node
很久没写博客了,终于把重心找回来了,不过没有以前有斗志.有理想.有目标了.慢慢来.你若问我我最近几年的规划是什么,还真不知道.突然发现摧毁一个人真的很简单.k8s也是一遍一遍的从入门到放弃,还是要好好 ...
- Mysql查漏补缺笔记
目录 查漏补缺笔记2019/05/19 文件格式后缀 丢失修改,脏读,不可重复读 超键,候选键,主键 构S(Stmcture)/完整性I(Integrity)/数据操纵M(Malippulation) ...
- 爬虫篇-python爬虫中多线程的使用
queue介绍 queue是python的标准库,俗称队列.可以直接import引用,在python2.x中,模块名为Queue.python3直接queue即可 在python中,多个线程之间的数据 ...
- Bootstrap 提示工具(Tooltip)插件
一.提示工具(Tooltip)插件根据需求生成内容和标记,默认情况下是把提示工具(tooltip)放在它们的触发元素后面. 有以下两种方式添加提示工具(tooltip): 1.通过data属性:如需添 ...
- 【转】Pandas学习笔记(一)基本介绍
Pandas学习笔记系列: Pandas学习笔记(一)基本介绍 Pandas学习笔记(二)选择数据 Pandas学习笔记(三)修改&添加值 Pandas学习笔记(四)处理丢失值 Pandas学 ...
- android 8.0 悬浮窗 最简demo
MainActivity.java文件 package com.example.performance; import android.app.Activity; import android.con ...
- nginx 请求限制
1.nginx 请求限制 1.连接频率限制 - limit_conn_module 2.请求频率限制 - limit_req_module 连接限制的语法 请求限制的语法 limit_conn_zon ...