码迷,mamicode.com
首页 > 其他好文 > 详细

jmeter 常用内置变量

时间:2018-07-03 21:42:03      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:ESS   var   response   utf-8   put   rop   pre   org   encoding   

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 常用内置变量

标签:ESS   var   response   utf-8   put   rop   pre   org   encoding   

原文地址:https://www.cnblogs.com/linbo3168/p/9260514.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!