Question

Alright guys,

I am writing a custom java 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?

Any help is much appreciated.

Thanks!

Ninn

Was it helpful?

Solution

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);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top