当前位置:网站首页>BeanShell built-in variable CTX
BeanShell built-in variable CTX
2022-07-24 05:17:00 【Agricultural garden】
1 brief introduction
It can easily access the context of the current thread
stay JMeter Inside ,ctx It maps to org.apache.jmeter.threads Of JMeterContext class because JMeterContext
No thread safety , Therefore, it is only applicable to use in single thread
Official documents :https://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterContext.html
2 Common methods
2.1 getVariables
Method statement
public JMeterVariables getVariables()
function : obtain JMeter All variables of the current thread
vars.put("name","shenzhen");
shen = ctx.getVariables().get("name");
log.info("name value is "+ shen);
result :
2.2 getProperties
Method statement
public Properties getProperties()
function : Get all JMeter attribute
sh = ctx.getProperties().getProperty("sampleresult.default.encoding");
log.info("sampleresult.default.encoding value is "+sh);
result :
2.3 getPreviousResult
Method statement
public SampleResult getPreviousResult()
function : Get the results of the previous sampler
import org.apache.jmeter.samplers.SampleResult
SampleResult rsp= ctx.getPreviousResult();
String sh= rsp.getResponseDataAsString();
log.info("\n"+sh);

result :
2.4 getCurrentSampler
Method statement
public Sampler getCurrentSampler()
function : Get the current sampler object
shs =ctx.getCurrentSampler().getName();
log.info("csn value is "+shs);
result :
2.5 getPreviousSampler
Method statement
public Sampler getPreviousSampler()
function : Get the previous sampler object
shs =ctx.getPreviousSampler().getName();
log.info("csn value is "+shs);
result :
2.6 getThreadNum
Method statement
public int getThreadNum()
function : Get the thread number under the current thread group ( Number from 0 Start )
2.7 getThread
Method statement
public JMeterThread getThread()
function : Get thread object
shs =ctx.getThreadNum();
log.info("csn value is "+shs);
shsname =ctx.getThread().getThreadName();
log.info("shsname is "+shsname);
result :
2.8 getThreadGroup
Method statement
public AbstractThreadGroup getThreadGroup()
function : Get thread group object
shs =ctx.getThreadGroup().getName();
log.info("csn value is "+shs);

边栏推荐
- Image to image translation with conditional advantageous networks paper notes
- [database connection] - excerpt from training
- Crazy God redis notes 09
- The difference between statement and Preparedstatement and how to use placeholders
- 。 Single type digital sensing is an application 0 Up address is at the factory
- Chapter 9 using image data
- 酒店IPTV数字电视系统解决方案
- Hanoi problem
- 线程
- Source code compilation!!
猜你喜欢

Token of space renewable energy

Ia notes 2

Icml2022 | rock: causal reasoning principle on common sense causality

Use of fiddler packet capturing tool

Beginners' preparation for the Blue Bridge Cup (University Programming learning history records, topic ideas for students who need to prepare for the Blue Bridge Cup)
![[database connection] - excerpt from training](/img/7d/334b4b7f0f6e1de228c4ecb1e600a3.png)
[database connection] - excerpt from training
![Embedded system transplantation [2] - Construction of cross development environment](/img/96/8d209c04e41675fc0efaa872c35615.png)
Embedded system transplantation [2] - Construction of cross development environment

IDEA:SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder“.

Globally and locally consistent image completion paper notes

Image painting for irregular holes using partial revolutions paper notes
随机推荐
PPPoE网关模拟环境搭建
线程的介绍
Un7.23: how to install MySQL on linix?
Support complex T4 file systems such as model group monitoring and real-time alarm. e
Hcip day 3 - mGRE experiment
Globally and locally consistent image completion paper notes
The difference between statement and Preparedstatement and how to use placeholders
EMQX 简单使用
NumPy 统计相关函数示例教程
HCIA NAT experiment
Smart pointer, lvalue reference, lvalue reference, lambda expression
pso和mfpso
IDEA:SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder“.
Kingbase v8r6 cluster installation and deployment case - script online one click expansion
[Basic 6] - encapsulation and inheritance of classes, objects and classes
Read the summary of "machine learning - Zhou Zhihua"
。单类型数字传感一个应用程.0。 Up- 开址在出厂
The second chapter is encog's data acquisition
Rlib learning - [4] - algorithmconfig detailed introduction [pytoch version]
7. Find the sum of numbers between 100 and 300 that can be divided by 3.