如果你想从头学习Jmeter,可以看看这个系列的文章哦
https://www.cnblogs.com/poloyy/category/1746599.html
前提
BeanShell 有的内置变量,JSR223 也会有对应的变量,这里 JSR223 效率更高,所以以它为栗子
简单介绍
- prev 提供对当前取样器结果的访问能力
- prev 映射 org.apache.jmeter.samplers 的 SampleResult 类
- 官方文档: https://jmeter.apache.org/api/org/apache/jmeter/samplers/SampleResult.html
常用方法
getResponseCode
方法声明
public String getResponseCode()
功能
获取响应状态码
栗子代码
sc = prev.getResponseCode() ; log.info('status code is: ' + sc)