jmeter 常用内置变量
Posted linbo3168
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jmeter 常用内置变量相关的知识,希望对你有一定的参考价值。
1. vars API:http://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterVariables.html
vars.get("");
vars.put("",XXX);
2. log
log.info("xxx");
3.ctx API:http://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterContext.html
ctx.getThreadNum()
4.props
encoding = props.get("sampleresult.default.encoding");
log.info("sampleresult.default.encoding="+encoding);
5.prev API:http://jmeter.apache.org/api/org/apache/jmeter/samplers/SampleResult.html
System.out.println(prev.getResponseCode());
System.out.println(prev.getResponseDataAsString());
prev.setResponseCode("222");
System.out.println(prev.getResponseCode());
prev.setResponseMessage("qiaoyeye你好");
System.out.println(prev.getResponseMessage());
prev.setResponseData("qiaoyeye你好","UTF-8");
System.out.println(prev.getResponseDataAsString());
System.out.println(${port});
System.out.println(ctx.getThreadNum());
1 log.info("内置变量"); 2 ipString = vars.get("ip"); 3 log.info("ipString="+ipString); 4 vars.put("newip",ipString); 5 log.info("newip="+vars.get("newip")); 6 encoding = props.get("sampleresult.default.encoding"); 7 log.info("sampleresult.default.encoding="+encoding);
以上是关于jmeter 常用内置变量的主要内容,如果未能解决你的问题,请参考以下文章
C#-WebForm-★内置对象简介★Request-获取请求对象Response相应请求对象Session全局变量(私有)Cookie全局变量(私有)Application全局公共变量Vi(代码片段