How do I load test with multiple socket connections using Jmeter? - testing

Also if I have authorisation header fields-> Where and how do I give them?? Is there any tool for this?
I have done local host "ws://localhost:8080/socket" using

If you are using the "WebSockets Samplers" plugin with JMeter, you can open multiple websocket connections, but not at the same time on the same thread (JMeter user). If you are sure you need that feature, there is an experimental build of the plugin that supports multiple connections on one thread.
You can add authorisation fields by using the standard JMeter HeaderManager.

Related

How to setup hosting for Multiple mock services using Karate DSL , which will be hosted for long

We have lot many vendors and not all have sandboxed environments made available to test integration.
I was looking to mock them and thus would host them myself, we are using karate extensively as our BDD tool.
How can multiple mock services be hosted using single project?(Multiple Feature files)
How can I achieve different hostname for different mock services?
Can it be used as a regular server running for long?
Similar question : Using mocks in Karate DSL feature file with stanalone run
How can multiple mock services be hosted using single project
Refer the answer you linked. Use Java code for the best way to start multiple mocks.
How can I achieve different hostname for different mock services?
Normally you change your services config to point to where the mock is running, typically localhost + : + portNumber - also refer the docs on using Karate as am HTTP proxy, and also search the net on modifying etc.hosts entry if needed.
Can it be used as a regular server running for long?
Keep in mind that Karate is a "mock" :) but if you don't keep adding data to what is in-memory it should be fine. No guarantees though :P

Does javamelody work with spring webflux?

can anyone point me to a resource, how I can get spring-webflux and javamelody to work together?
Seems, that a servletcontext is neccessary for startup, which I don't have/need.
I'm aware of the coll metrics stuff, that comes with spring-boot 2.x, but I don't have anything to display the metrics with, and am locked to a company environment, where just installing something isn't a valid option.
Thanks,
Henning
javamelody is mainly based on monitoring of memory, cpu, http requests, sql requests and spring components among other things. See javamelody-spring-boot-starter for example.
But as far as I know, Spring webflux does not use the servlet api. So what do you want to monitor?
If you just want to have graphs in a browser, then start a http server for javamelody reports like in standalone. And if you also want to monitor sql requests and spring components, then add in your application all methods from this example, except monitoringSessionListener and monitoringFilter.
A new spring-boot-starter for javamelody in webflux could be created if it makes sense.

Spring boot websocket test

I have a spring boot project with websocket and I want to test the project sending multiple request to the socket from different users. I want to use threads to imitate the users that send data from the web app but I don't know exactly how to make the test. Can anyone help me, and show one simple test for an websocket using threads?
You can use JMeter for testing your websocket project.
For further reading:
https://www.blazemeter.com/blog/websocket-testing-apache-jmeter
http://www.baeldung.com/websockets-spring
Good example:
https://github.com/Fyro-Ing/JMeter-WebSocket-StompSampler
When writing a Spring Boot application using STOMP on websockets, I struggled a lot to find out how to configure a test client.
I ended up writing a little library called Jackstomp to make it easier to create type-safe tests for STOMP WS applications using JSON as message body.
I haven't used it with multiple threads, but you should be able to easily use it within each thread to create independent clients for each user and perform basic operations. (Please note that a different client should be used in each thread).
The point is that you can really express a synchronous flow for each client, including actively querying for received events.
Even if you don't use this library, you can look at the code to get a grasp of the different things to setup.

Mule: Do I need a DevKit?

I have a scenario in which I have to isolate every inbound HTTP Connection and store it in a hash storage (like a Hashtable) along withe username & other connection information.
How do I isolate this HTTP connection in a mule flow? I think I might need to install DevKit? That way I could use annotations based java classes and get a handle on the connection.
Or is that an overkill? Because firstly I don't see the devkit tab in my studio. Is there an alternate way of achieving the same?
I did not get the part of isolating the HTTP Connections though , but if you wish to use Devkit you first need to install it in your AnypointStudio
Go into Help >Install New Software >Select Devkit Update Site
If you do not have the Devkit Update Site in your studio do use this link.

IBM Worklight - Connecting/Re-Connecting: WL.Client.connect vs. connectOnStartup vs. WL.Client.invokeProcedure

In our project we are trying to figure our what the best process to connect to the server will be - especially when taking care of offline/online scenarios etc.
Right now, for us, it seems that all three options to connect to the WL server are similar. Whatever option we use, we can call our Adapter Procedures perfectly and we receive Notification Messages that are set in the console.
We are not sure about Direct Update - this is not working properly yet.
Are there any important differences between these three ways of connecting to the WL server, or is basically the same connection procedure being executed in all three cases?
How about WL.Client.init() before connecting - could we call that again (in addition to the standard window load EventListener) in our code before we connect using a WL.Client.connect manually - or is init() supposed to be called only once?
Tied to that is also offline and re-connecting.
As far as I have read in the tutorials, the WL Client framework is managing the connection state. Does that mean that when the WL client is connected to the server through any of these three ways and loses it's WLAN/3G/4G connection (or it's access to the WL server due to internet connection blocker or so) it re-connects automatically (regularly tries to re-connect until successful) when a connection to the WL server is available again?
EDIT
I was thinking about Events or Threads that provide more low-level information (not WORKLIGHT_IS_CONNECTED) - basically events that would be triggered when the device loses/gets WIFI/3G/4G connection and/or internet connection. Or is there only polling using WL.Device.getNetworkInfo() available?
Would the use of Cordova Event like:
document.addEventListener("offline", yourCallbackFunction, false);
provide a functionality close to that?
Though those three ways do have some similarities the differences between them are very important.
WL.Client.init() initializes client side WL framework.
WL.Client.connect() triggers connection request to WL server.
initOptions.connectOnStartup defines whether WL.Client.connect() will be invoked automatically during WL.Client.init().
In general - most of the functionality (e.g. adapters, remote disable) will function even if you call WL.Client.invokeProcedure() without calling WL.Client.connect(). But there are several things that will not function:
You will not be able to fully utilize push notifications without calling WL.Client.connect()
Direct update is triggered during WL.Client.connect()
WL.Client.connect() will get security related info from server, e.g. names of realms, whether user authenticated in those realms etc. Therefore all APIs like WL.Client.getUserInfo, .isAuthenticated(), .getUserName() etc will not function.
It is strongly recommended to start your session with WL.Client.connect() (or initOptions.connectOnStartup=true).