I would need to test the "resistance" of the server receiving an increasing number of websocket connections, through which data is sent over MQTT.
To that purpose, I created a simple webpage which has an "onLoad" directive so that when it loads, it connects to the server over websocket and starts receiving the data. In order to simulate (and increase the number of websocket connections), I thought about JMeter with a Loop controller that opens the page. However, I note that when the page is loaded by JMeter, it does not establish the websocket (in other words, it discards the "onLoad") javascript directive in the page. Is there a special JMeter configuration I'm missing? Is there another way to achieved what I would like?
Many thanks - Christian
As per JMeter project main page:
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
therefore your onload event is being absolutely ignored by JMeter's HTTP Request sampler as it doesn't execute any functions.
If you want to load test your websocket backend you will need to go for JMeter WebSocket Samplers and establish connection/send payload using the relevant samplers. The plugin can be installed using JMeter Plugins Manager, there are JMeter WebSocket Samplers - A Practical Guide article and some example JMeter scripts which you can use as the reference
Related
I am trying to do API end points testing with JMeter. I am able to create test cases using JMeter GUI. But, facing while integrating JMeter with Maven Project. Please Help me.
There is no easy way to display the details of the failed requests, JMeter Maven Plugin is capable of only generating a HTML Reporting Dashboard which failures reporting capabilities are limited to:
The error table providing a summary of all errors and their proportion in the total requests
The Top 5 Errors by Sampler table providing for every Sampler (excluding Transaction Controller by default) the top 5 Errors :
So the options are in:
Modify the response message and add to it the information you need using i.e. JSR223 Listener
Use Flexible File Writer Listener to store request and response data and whatever else you need into a separate file
Amend the FreeMarker templates in the report-template folder according to your needs and configure JMeter to use this modified template folder for the dashboard generation
Any combination of all above
I am looking for a way to dump http request & reaponse body (json format) in resteasy on wildfly 8.2.
I've checked this answer Dump HTTP requests in WildFly 8 but it just dumps headers.
I want to see the incoming json message and outgoing one as well.
Can configuration do it without filter or any coding?
Logging HTTP bodies is not something frequently done. That's probably the primary reason for RequestDumpingHandler in Undertow only logging the header values. Also keep in mind that the request body is not always very interesting to log. Think for example of using WebSockets or transmitting big files. You can write your own MessageBodyReader/Writer for JAX-RS, and write to a ByteArrayOutputStream first, then log the captured content before passing it on. However, given the proven infeasibility of this in production, I think your mostly interested in how to do this during development.
You can capture HTTP traffic (and in fact any network traffic) using tcpflow or Wireshark. Sometimes people use tools such as netcat to quickly write traffic to a file. You can use for example the Chrome debugger to read HTTP requests/responses (with their contents).
Wondering if there's a clean correct way to load html markup through websockets instead of through a $.ajax({...}) request. I'm somewhat new to websockets so I'm trying to figure out where it can completely replace AJAX and so on...
Right now I just create another 'post' router in my NodeJS app to load the html but I don't know if all of that is even neccessary.
you need websockets mostly if you want to maintain a bidirectional connection between client and server, useful for real-time applications (like chats, stock marketing, e-learning etc.).
if you need to load html mark down, you don't need to go back and forth from client to server many times to load the content and serve it, it will be much elegant and not wasteful way.
you can also use to get route and $.get ajax requests if you do not want to pass additional payload to the server.
Certainly you can pass data through websockets to your client from the Node.js server and, once on the client, just post it to the page.
If you are using socket.io, for example, you can emit an event inside your server with your generated html which will be received at client code:
On the server:
socket.emit('yourFiringEvent', variableContainingYourRawHtml);
On the javascript client:
socket.on('yourFiringEvent', function(htmlResult) {
$("#yourContainerId").html(htmlResult); //jQuery flavour ;-)
});
When your client code receives the event from server will load the data on variableContainingYourRawHtml inside of HtmlResult
If you aren't using it I recommend the use of socket.io library for websocket use, it's quite powerful and easy:
http://socket.io/
I have a simple RESTful web service and I wish to test the PUT method on a certain resource. I would like to do it in the most simple way using as few additional tools as possible.
For instance, testing the GET method of a resource is the peak of simplicity - just going to the resource URL in the browser. I understand that it is impossible to reach the same level of simplicity when testing a PUT method.
The following two assumptions should ease the task:
The request body is a json string prepared beforehand. Meaning, whatever is the solution to my problem it does not have to compose a json string from the user input - the user input is the final json string.
The REST engine I use (OpenRasta) understands certain URL decorators, which tell it what is the desired HTTP method. Hence I can issue a POST request, which would be treated as a PUT request inside the REST engine. This means, regular html form can be used to test the PUT action.
However, I wish the user to be able to enter the URL of the resource to be PUT to, which makes the task more complicated, but eases the testing.
Thanks to all the good samaritans out there in advance.
P.S.
I have neither PHP nor PERL installed, but I do have python. However, staying within the realm of javascript seems to be the simplest approach, if possible. My OS is Windows, if that matters.
I'd suggest using the Poster add-on for Firefox. You can find it over here.
As well as providing a means to inspect HTTP requests coming from desktop and web applications, Fiddler allows you to create arbitrary HTTP requests (as well as resend ones that were previously sent by an application).
It is browser-agnostic.
I use the RESTClient firefox plugin (you can not use an URL for the message body but at least you can save your request) but also would recommend curl on the command line.
Maybe you should also have a look at this SO question.
I put together an applet that uploads images via as3httpclientlib to a servlet. The applet works fine in debug mode (through flash builder) and until today it worked when deployed.
From the servlet logs, it appears the servlet never receives the image(s) byte stream, therefore my hunch is the applet is not posting the multipart data.
Can anyone suggest what I should do next to find the cause of the problem?
I suppose you ran into problem described here:
In Flash Player 10 and later, if you
use a multipart Content-Type (for
example "multipart/form-data") that
contains an upload (indicated by a
"filename" parameter in a
"content-disposition" header within
the POST body), the POST operation is
subject to the security rules applied
to uploads:
The POST operation must be performed
in response to a user-initiated
action, such as a mouse click or key
press.
If the POST operation is
cross-domain (the POST target is not
on the same server as the SWF file
that is sending the POST request), the
target server must provide a URL
policy file that permits cross-domain
access.
So I think you should run your application using debugger and check Flex client logs for exceptions described above.