开发者

Sampler Result setResponseData not setting in JMeter

开发者 https://www.devze.com 2023-03-08 03:39 出处:网络
I am writing a custom ja开发者_开发百科va class to grab objects from a Coherence grid. It works well through JMeter, but the response data isn\'t filling it\'s place in the JMeter GUI. This is how I\'

I am writing a custom ja开发者_开发百科va class to grab objects from a Coherence grid. It works well through JMeter, but the response data isn't filling it's place in the JMeter GUI. This is how I'm filling the SamplerResult:

result.setResponseData(getResponseData(cache.get(key)).getBytes());

the getResponseData(Object); returns a simple String that I'm pulling the bytes out of. But, the response data is still empty. I can put the data inside of the result.setSamplerData(String) but it's it will not populate inside of the ResponseData. It needs to be inside of the ResponseData because it's the only way that a Regular Expression Extractor can be used.

Is there something here that I'm missing?


Calling setResponseData(String, Encoding) or setResponseData(byte[]) is correct when implementing a sampler.

The regular expression extractor uses, depending on what you set in the gui, one of the following: getResponseDataAsString(), getResponseMessage(), getResponseCode(), getResponseHeaders(), getUrlAsString().

So this should work, if your byte[] is something that represents a valid string.

Alternatively, just setting your variables in your sampler might solve your current use case: getThreadContext().getVariables().put(name, value);

0

精彩评论

暂无评论...
验证码 换一张
取 消