Jmeter-Beanshell Assertion-内置变量的使用

​针对Beanshell Assertion提供的内置变量,需要区分类型。对于字符串类型可在Beanshell Assertion内部直接使用,而针对对象类型,则可在此类型上调用方法。

SampleResult          对象类型

Response                对象类型

ResponseData        byte[]

ResponseCode       字符串

ResponseMessage 字符串

ResponseHeaders  字符串

RequestHeaders     字符串

SampleLabel           字符串

SamplerData           字符串

Successful              boolean

log.info("原生的ResponseData============================:"+ResponseData);

log.info("转换后的的ResponseData2========================:"+new String(ResponseData));

String reponseDataAsString = Response.getResponseDataAsString();

String reponseDataAsString2 = SampleResult.getResponseDataAsString();

log.info("reponseDataAsString============================:"+reponseDataAsString);

log.info("reponseDataAsString2============================:"+reponseDataAsString2);

log.info("isSuccessful=============================:"+Successful);

log.info("ResponseCode=============================:"+ResponseCode);

log.info("ResponseMessage=============================:"+ResponseMessage);

log.info("SampleLabel=============================:"+SampleLabel);

log.info("SamplerData=============================:"+SamplerData);

Jmeter-Beanshell Assertion-内置变量的使用_第1张图片

注下:isSuccessful为boolean类型

Jmeter-Beanshell Assertion-内置变量的使用_第2张图片

你可能感兴趣的:(Jmeter-Beanshell Assertion-内置变量的使用)