JMeter-WebSocketSampler
JMeter-WebSocketSampler copied to clipboard
Response pattern not working with streaming connection
Hello! I have three websocket samplers which share the connection, the problem is, that response pattern is checked only for the first sampler, it is visible from the sampler execution flow. 1st sampler: http://grab.by/vrt8 2nd sampler config: http://grab.by/vrte and result: http://grab.by/vrtg
Response assertion with same pattern attached to 2nd sampler successfully matches the response, btw
This is because regexp patterns are forwarded to analyzer in socket only once at the moment of connection creation and then those patterns are not reset by next samplers using the same connection.
I've done a small change to overwrite this behavior. If you are interested, here is the piece of code to be added.
ServiceSocket class (add three rows below at the end of initialize method): public void initialize(WebSocketSampler _parent) { logMessage = new StringBuffer(); logMessage.append("\n\n[Execution Flow]\n"); logMessage.append(" - Reusing exising connection\n"); error = 0;
this.closeLatch = new CountDownLatch(1);
this.responsePattern = new CompoundVariable(_parent.getResponsePattern()).execute();
this.disconnectPattern = new CompoundVariable(_parent.getCloseConncectionPattern()).execute();
initializePatterns();
}
In WebSocketSampler socket.initialize() call should be modified:
if (connectionList.containsKey(connectionId)) { socket = connectionList.get(connectionId); socket.initialize(this); return socket; }
i also came across this bug
Same problem as well.
Same bug. Hope it will be fixed soon.
Hello, I also came across this bug. Is there any fix for this ?