JMeter-WebSocketSampler icon indicating copy to clipboard operation
JMeter-WebSocketSampler copied to clipboard

Response pattern not working with streaming connection

Open bromanov opened this issue 10 years ago • 6 comments

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

bromanov avatar Mar 25 '14 13:03 bromanov

Response assertion with same pattern attached to 2nd sampler successfully matches the response, btw

bromanov avatar Mar 26 '14 08:03 bromanov

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

vladimir-gritsenko avatar Apr 21 '14 10:04 vladimir-gritsenko

i also came across this bug

samallison avatar May 28 '14 09:05 samallison

Same problem as well.

Marc--Olivier avatar Jul 16 '14 11:07 Marc--Olivier

Same bug. Hope it will be fixed soon.

nagornyi avatar Feb 09 '16 03:02 nagornyi

Hello, I also came across this bug. Is there any fix for this ?

bartamihai avatar Oct 28 '19 14:10 bartamihai