How test in Postman events received in a websocket - websocket

I'm sending a Post to http://{{server}}/ExternalInterface/Service/NewEntry this create a newEntry. The request is something like:
<NewEntryResponse>
<NewEntryResult Token="997D7643267640F2F26027ABF3251C90"
Timestamp="2020-02-03T15:20:06.7821712Z"
IdRequest="0" Result="ResultOK">
<IdEntry>45</IdEntry>
<IdZone>1</IdZone>
<Description>New entry create</Description>
</NewEntryResult>
</NewEntryResponse>
Moreover, it's created an "event" that is sent to a websocket with the next messsage:
<EventWithTokenList xsi:type="EntryNewEvent"
Timestamp="2020-02-03T15:20:07.6029057Z">
<ListTokens />
<IdEntry>45</IdEntry>
<IdZone>1</IdZone>
<Description>New entry create</Description>
</EventWithTokenList>
In Postman I can test the post request with different tests but I don't know how I can test that the Event receive in the websocket is correct with Postman.
Thank you for any idea to test the Event received in the websocket in Postman.

Related

Sumologic sending alerts to SLACK

I tried to send alerts from Sumologic to Slack. But when I test the connection, it always failed and return 400 http code. I used the connection type as Webhook
When test the connection, it should pass
If you are using WebHook and testing the connection, you must use a valid payload. If you don't provide a valid payload, the connection test will not succeed.
You can use the connection type as SLACK over WebHook. Still, you are using a webhook URL.
This link shows how to integrate Sumologic with Slack.
https://www.youtube.com/watch?v=qEz8dcp9SgI

How to fix error 422 Unprocessable Entity in Jmeter?

I am trying to create a Student and Teacher profiles while using Jmeter. So i am placing a POST http request in Jmeter getting Response code: 422, Response Message: unprocessable entity error. But the same requests are getting success in Postman.
here is the POST request
Student: {"mobile_country":"60","mobile_number":"189557840","name":"Reddy","email":"reddy#gmail.com","gender":"male","enrollment_date":"2022-09-01","description":"social teacher"}
Please help me, how to resolve this issue. Thanks in advance
As per 422 Unprocessable Entity error description:
The HyperText Transfer Protocol (HTTP) 422 Unprocessable Entity response status code indicates that the server understands the content type of the request entity, and the syntax of the request entity is correct, but it was unable to process the contained instructions
so unless your server is lying it means that there is a problem with your request payload.
Given the request is "getting success" in Postman and not "getting success" in JMeter it means that you're not sending the same request. I'd recommend using an external sniffer tool like Fiddler or Wireshark to inspect requests from Postman and JMeter, identify the differences and amend your JMeter configuration to match Postman with 100% accuracy.
If you cannot figure what is the inconsistency just record the request using JMeter's Proxy Server
Prepare JMeter for recording. Start HTTP(S) Test Script Recorder from the recording template.
Prepare Postman for Recording
Import JMeter certificate to Postman
Configure Postman to use JMeter as the proxy
Run your request in Postman
JMeter will generate the appropriate HTTP Request sampler and HTTP Header Manager

How to wait until receiving multiple websocket responses send in sequence, for a single request sent, using JMeter

I am using the Jmeter WebSocket Sampler. I have successfully connected to the websocket, and can send a json request. It is a chat bot, and I will be validating it's response.
However, I have observed in websocket log, the websocket responds to the json request with a short confirmation response before the actual response.
for example, the first response is {"event":joingame,} where the response is {"event":"game"}. I don't really need this information.
Only then is the real response sent (as I observed in webscoket log)
I have tried the general Websocket Sampler.
The websocket responses come in "frames", each having a JSON response, my samplers are closing right after the first frame.
You might want to switch to the WebSocket Samplers by Peter Doornbosch which can be installed using JMeter Plugins Manager
This way you will be able to establish a connection first:
and then continue reading the frames re-using the connection unless you find the frame with the content you're looking for:
It makes sense to use JSON Extractor and While Controller in order to continue reading until the anticipated text appears in the response.
More information: JMeter WebSocket Samplers - A Practical Guide

Spring Integration - Outbound Gateway - Chaining

I have a FileUpload Event that should be sent over to a http:outbound upload URL. In order to do this I have to first authenticate login URL and get the response and set the session id for outbound upload URL to execute. In my case, I have an event listener which listens for the application to publish the event of File Upload. Once it is published my listener can pick up and execute the flow. I am trying to see how this can be implemented because File Upload object would need to persisted until the Login response comes back. Thanks!
For this purpose we suggest a Header Enricher pattern. So, you place that "FileUpload Event" object into some header and restore it back to the payload when you get that session id response.
So, you add a Header Enricher before first HTTP Outbound Gateway.
After this gateway you rearange your message to place that header back into a payload and do something with a session id. (Header I guess?). And only after that your have another HTTP Outbound Gateway for uploading your file.

HTTP request on JMeter test failure

In my JMeter test, if there is any error, I want to trigger HTTP request to post a message on my system for further attention. What can I do here? Mail visualiser works fine to report errors over email. I want to do the same but over HTTP request. I am using jmeter 3.2.
You can do something like:
Add If Controller after the HTTP Request sampler and put the following code into "Condition" area:
`!${JMeterThread.last_sample_ok}`
Add SMTP Sampler as a child of the If Controller and configure your email server details, credentials, message, etc. there - see Load Testing Your Email Server: How to Send and Receive E-mails with JMeter article for more details.
JMeterThread.last_sample_ok is a pre-defined JMeter Variable holding the result of previous sampler execution, it is true if previous sampler is successful and false otherwise. Due to the If Controller the SMTP Request sampler will only be executed in case of HTTP Request sampler failure which seems to be something you're looking for.

Resources