Answered question

Websocket Message Mapping

Hi,

I am trying to evaluate Neoload for our application which uses websockets. I’m using Neoload Free Edition 7.0 and the trial license I have has WebSocket & Push module.

I have recorded and successfully played back a websockets script and I can see that the replay has successfully updated the record that I used initially for my 1st recording. However I now wish to be able to capture and updated random records rather than the hard coded one that I used for recording. Normally I would use correlation (using the regular expression – “AlarmId”:”(.*?)”) to capture the values returned and use them.

However, I can see that the recorded responses from the WebSocket channel shows multiple responses – only some of which contain the records that I need. Reading the manual I understand that as websockets is asynchronous there is no concept of single request/response and that I may need to implement message mapping to do what I need.

I can see references in the Neoload documentation toward messaging mapping but I am unable to implement it correctly. Are there step by step instruction on how to implement message mapping for websockets available?

Ajaz Z.
Ajaz Z.

Ajaz Z.

Level
0
19 / 100
points

A WebSocket channel is a permanent connection with the server so it can send data to the connected clients. That's why you get multiple responses without any user interaction.

That being said the mapping feature is to map a WebSocket request to a specific response received on the WebSocket channel. That means that this request will be blocked until the response is received.

I'm not sure if it's what you would like to do. If your need is only to extract your AlarmID you could create a variable extractor on the WebSocket channel itself.

Configure that variable extractor to not raise any error if there's no match. This is because that extractor will be applied on all responses received on that channel and you do not want an error each time nothing is matched.

Then still in the variable extractor definition i would suggest to stop the extraction on first match in case other values can match it so your value is not overwritten. This option is available in advanced mode of your variable extractor.

Be careful on the variable extractor definition you can select a specific response to create your extractor but it does not mean that it will only be applied on that response number. So by default the definition will switch back to response0 after you save it and it's a normal behavior.

If you do need the mapping option please look at this tutorial here

 

Did you find this useful ?

No (0)

Yes (1)

100%

100% of users found this answer useful