Signalr load testing in JMeter - websocket

I'm trying to do JMeter script for an application with Signalr protocol.
I'm able to identify connection-token, bearer-token, connection-id and co relate with request using long polling transport and receive message, but after third polling I could not receive the correct response, i'm getting response but not the expected and full response.
Could you please help me what could be the issue here?

I'm afraid no one will be able to help without seeing at least:
Anticipated response
Actual response
Reference requests sequence from i.e. real browser captured with a sniffer tool like Wireshark or Fiddler
The same as point 3 but for JMeter instead of the real browser.
Basically you need to execute points 3 and 4 and compare the generated network requests - they must be the same apart from the dynamic parameters (tokens, connection-id, etc.). Given requests are the same - you should be getting the same responses.
Another option is using While Controller in order to continue polling unless response matches your expectation.

Related

JMeter & socket.io - I can see the message I want, but the socket plugin is not showing what I expect

Here is the socket message I see in the browser debugger console:
More illustrative, perhaps:
I call an API operation that triggers this message over a socket.
What I Tried
To preclude inaccuracies, I started 2 instances of JMeter.
REST API call.
Revised version of the GitHub JMeter example of sockets.io, in which I just call a WebSocket Sampler repeatedly on wss://events.dev.myserver.com:443/socket.io/?EIO=4&transport=websocket.
I kicked off (2).
While that was running, I kicked off (1).
Expected
Eventually, (1) should show me a sampler in the View Results Tree with the message in the screenshot ("42" - GAME_STARTED)
Actual
The only messages I see look like this:
This is really all I want to do: run the appropriate sampler, a sufficient time after making the API call, to get the message.
Update
We succeeded in finding the message using python-socketio:
sio.connect("https://events.dev.server.com", transports='websocket',
headers={'Sec-WebSocket-Extensions: permessage-deflate', 'Sec-Fetch-Dest: websocket',
'Sec-Fetch-Mode: websocket',
'Cookie: ABCSESSIONDEV=NTI3MzkwNWUtMTJmNS00Y2U0LTk1NGUtMjQ2Mzk5OTYxZWE0'})
And here is the output:
Received packet MESSAGE data 2["message","{\"locationId\":110,\"name\":\"GAME_STARTED\",\"payload\":{\"id\":146724,\"boxId\":2002,\"userId\":419,\"createdAt\":\"2022-03-02T14:35:31\",\"lastModifiedAt\":\"2022-03-02T14:35:36.752\",\"completedAt\":\"2022-03-02T14:35:36.621\",\"activationMethod\":\"TAG\",\"nfcTagId\":\"xxxxxx\",\"gameCount\":1,\"app\":false}}"]
I would like to use the websocket plugin to do this in JMeter now.
tried adding Cookie to WebSocket call - only sids, no messages.
tried adding Cookie to an HTTPS request (like the above code) - 400, bad request.
Take a look at other fields of the HTTP Request, in particular HTTP Headers, most probably your JMeter request is missing some essential information.
My expectation is that in order to "start the game" (whatever it means) you need to open the page in the browser, authorize somehow, follow the steps of the protocol upgrade mechanism, etc. to wit exactly mimic what real browser does, all the request sequence which is prior to starting the game.
You might need to correlate dynamic parameters, add HTTP Header Manager, add HTTP Cookie Manager, etc.

Page Redirect ErrorPage.aspx

I am executing performance tests in the Jmeter. However, I am an issue in response data. It's showed the following message:
1|#||4|58|pageRedirect||%2fDFE_PT%2fErrorPage.aspx%3fOriginId%3d637772668313066879|
Meantime, the page contains two IDs that is changed each iteration on the page. I've configured and controlled those IDs through regular expression. I do not get because this message is being displayed. This is displayed in all requests.
Has someone any tip to overtake this issue?
Make sure that the JMeter Variables which are coming from the Regular Expression Extractors really contain the anticipated values, you can do this using Debug Sampler and View Results Tree listener combination.
If the variables have the values perform the further cross-check of the network footprint of your JMeter test and the real browser.
Capture the request(s) which is being sent by the browser using browser developer tools (or maybe even better a sniffer tool like Fiddler or Burp)
Do the same for the request(s) which is(are) being sent from JMeter
Compare everything:
URL
Headers
Request body
all should be the same (apart from dynamic parameters which need to be correlated)
Given JMeter will be sending the same request as browser does - you will get the same response.

What is jMeter doing with my requests - it is getting responses but shouldn't

So I made a copy of my jmx file and obfuscated the domain to include here. Be kind. I am a load testing noob. :)
I have a load testing target. I must be on the VPN to access the target's website. When connected to the VPN, my load test numbers make no sense. This is cool. I am not convinced I have the test created correctly. But what is weirder still is that when I am NOT connected to the VPN the requests receive a response. The results tree has pretty little green checkmarks (well really shield icons). But there is no way it should have been able to communicate with the server. But when I look at response body, it is a very reasonably approriate response body.
My jmx file is too big. I will try to attach it. But does anyone have an explanation for what might be going on? Or what I might have done wrong?
These "pretty little green checkmarks" doesn't mean that you're hitting the correct server, JMeter automatically treats HTTP Status Codes below 400 as successful so my expectation is that you're basically hitting some form of VPN web gateway login page or something like this and JMeter considers these redirects as successful responses.
You can inspect request and response details using View Results Tree listener and see what exact host you're hitting and what does the response say.
Going forward in order to protect yourself from these "false positive" results you can consider adding Response Assertions to your requests to ensure that response contains what it is supposed to be containing or alternatively doesn't contain errors

Response message: Unauthorized in Jmeter

I'm new to using Jmeter tool.
I have recorded my application using blazemeter (v3.1) and then trying to run that .jmx file in Jmeter, however I am running into an authorization issue and the script fails to run.
I have also tried setting my "HTTP Authorization Manager" with username, url, password but it does not help. If anyone can, please guide me on this Issue. Thanks.
As per 4 Things You Should Never Do with Your JMeter Script article:
Don’t run the script exactly as you recorded it
After recording your script, there is still some work to do before you run it. It’s necessary to correlate variables, parameterize and add elements, to faithfully simulate users.
There are too many ways of possible authentication implementation in your application, most probably you need to send some dynamic value along with credentials which can be fetched from the previous request.
Record your test scenario 2 times and compare recorded requests. Be careful as differences might be in response headers and URL, not only in response data. It makes sense to add View Results Tree listener directly to HTTP(S) Test Script Recorder - this way you will be able to see what data is captured by JMeter and amend its configuration so simulated request would look exactly like the request from the real browser.

Save response from certain WEB resources while recording scenario

I need to create scenario for user interaction with single-page WEB application. The application does lots of AJAX calls in order to authenticate user and get user data.
So I created simple scenario with HTTP Test Script Recorder and tried to record my script.
Everything went well, however I noticed that whilst request data is recorder properly, the response data is not recorder at all. I tried to enable Add assertions and Regex matching - but that didn't work as well.
Can you please advice how do I record response texts as well?
View Results Tree under proxy will record request, responses during recording.
This is useful to understand where a dynamic field comes from. This will help your find from which response X you need to extract data to inject in request X+N.
I think you may find this option useful to add in user.properties:
proxy.number.requests=true
This will give a number to each request and corresponding sampler so you will be able to find response for the request.
Once you have done this, you will start adding Post Processors (Regex, CSS/JQuery, XPAth ...) to Sampler X to extract data from its response.
This will create variables you can then use as ${varName} in request X+N.

Resources